Unit tests for single choice questions.
More...
Unit tests for single choice questions.
- Author
- Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
- Version
- $Id$
Definition at line 13 of file assSingleChoiceTest.php.
◆ createSampleQuestion()
static assSingleChoiceTest::createSampleQuestion |
( |
|
$obj_id = null | ) |
|
|
static |
Create a sample question and save it to the database.
- Parameters
-
integer | $obj_id | Object ID of the containing question pool object (optional) |
- Returns
- integer ID of the newly created question
Definition at line 37 of file assSingleChoiceTest.php.
39 $obj_id = ($obj_id) ? $obj_id : 99999999;
40 include_once
'./Modules/TestQuestionPool/classes/class.assSingleChoice.php';
41 $sc =
new assSingleChoice(
'unit test single choice question',
'unit test single choice question comment',
'Helmut Schottmüller', -1,
'<p>is a <strong>unit test</strong> required?</p>');
54 $sc->setObjId($obj_id);
Class for single choice questions.
◆ setUp()
assSingleChoiceTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 17 of file assSingleChoiceTest.php.
19 if (defined(
'ILIAS_PHPUNIT_CONTEXT'))
21 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
22 ilUnitUtil::performInitialisation();
26 chdir( dirname( __FILE__ ) );
◆ t_e_stCreation()
assSingleChoiceTest::t_e_stCreation |
( |
| ) |
|
Question creation test.
- Parameters
-
Definition at line 64 of file assSingleChoiceTest.php.
References $ilDB, and $result.
68 include_once
'./Modules/TestQuestionPool/classes/class.assSingleChoice.php';
69 $insert_id = ilassSingleChoiceTest::createSampleQuestion();
70 $this->assertGreaterThan(0, $insert_id);
74 $sc->loadFromDb($insert_id);
75 $this->assertEquals($sc->getPoints(),1);
76 $this->assertEquals($sc->getTitle(),
"unit test single choice question");
77 $this->assertEquals($sc->getComment(),
"unit test single choice question comment");
78 $this->assertEquals($sc->getAuthor(),
"Helmut Schottmüller");
79 $this->assertEquals($sc->getQuestion(),
"<p>is a <strong>unit test</strong> required?</p>");
80 $this->assertEquals(count($sc->getAnswers()), 2);
81 $result = $sc->delete($insert_id);
82 $this->assertEquals(
$result,
true);
Class for single choice questions.
◆ $backupGlobals
assSingleChoiceTest::$backupGlobals = FALSE |
|
protected |
The documentation for this class was generated from the following file: