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 assMultipleChoiceTest.php.
◆ createSampleQuestion()
static assMultipleChoiceTest::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 assMultipleChoiceTest.php.
39 $obj_id = ($obj_id) ? $obj_id : 99999999;
40 include_once
'./Modules/TestQuestionPool/classes/class.assMultipleChoice.php';
42 $mc =
new assMultipleChoice(
'unit test multiple choice question',
'unit test multiple choice question comment',
'Helmut Schottmüller', -1,
'<p><strong>unit tests</strong> are...</p>');
67 $mc->setObjId($obj_id);
Class for multiple choice tests.
◆ setUp()
assMultipleChoiceTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 17 of file assMultipleChoiceTest.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()
assMultipleChoiceTest::t_e_stCreation |
( |
| ) |
|
Question creation test.
- Parameters
-
Definition at line 77 of file assMultipleChoiceTest.php.
References $result.
81 include_once
'./Modules/TestQuestionPool/classes/class.assMultipleChoice.php';
82 $insert_id = self::createSampleQuestion(null);
83 $this->assertGreaterThan(0, $insert_id);
87 $mc->loadFromDb($insert_id);
88 $this->assertEquals($mc->getPoints(),2);
89 $this->assertEquals($mc->getTitle(),
"unit test multiple choice question");
90 $this->assertEquals($mc->getComment(),
"unit test multiple choice question comment");
91 $this->assertEquals($mc->getAuthor(),
"Helmut Schottmüller");
92 $this->assertEquals($mc->getQuestion(),
"<p><strong>unit tests</strong> are...</p>");
93 $this->assertEquals(count($mc->getAnswers()), 4);
94 $result = $mc->delete($insert_id);
95 $this->assertEquals(
$result,
true);
Class for multiple choice tests.
◆ $backupGlobals
assMultipleChoiceTest::$backupGlobals = FALSE |
|
protected |
The documentation for this class was generated from the following file: