Unit tests.
More...
Unit tests.
- Author
- Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Definition at line 11 of file assClozeTestTest.php.
◆ setUp()
assClozeTestTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 15 of file assClozeTestTest.php.
References assBaseTestCase\getDatabaseMock(), assBaseTestCase\getGlobalTemplateMock(), assBaseTestCase\getIliasMock(), and assBaseTestCase\setGlobalVariable().
17 if (defined(
'ILIAS_PHPUNIT_CONTEXT')) {
18 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
19 ilUnitUtil::performInitialisation();
21 chdir(dirname(__FILE__));
26 require_once
'./Services/UICore/classes/class.ilCtrl.php';
27 $ilCtrl_mock = $this->createMock(
'ilCtrl');
28 $ilCtrl_mock->expects($this->any())->method(
'saveParameter');
29 $ilCtrl_mock->expects($this->any())->method(
'saveParameterByClass');
32 require_once
'./Services/Language/classes/class.ilLanguage.php';
33 $lng_mock = $this->createMock(
'ilLanguage', array(
'txt'), array(),
'',
false);
setGlobalVariable($name, $value)
◆ test_cleanQuestionText_shouldReturnCleanedText()
assClozeTestTest::test_cleanQuestionText_shouldReturnCleanedText |
( |
| ) |
|
Definition at line 54 of file assClozeTestTest.php.
57 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
59 $in_text =
'Ein <gap>Männlein</gap> steht <gap id="Walter">im</gap> <b>Walde</b> ganz <gap 2>still</gap> und [gap]stumm[/gap]<hr />';
60 $expected =
'Ein [gap]Männlein[/gap] steht [gap]im[/gap] <b>Walde</b> ganz [gap]still[/gap] und [gap]stumm[/gap]<hr />';
62 $actual = $instance->cleanQuestiontext($in_text);
64 $this->assertEquals($expected, $actual);
◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()
assClozeTestTest::test_getAdditionalTableName_shouldReturnAdditionalTableName |
( |
| ) |
|
Definition at line 166 of file assClozeTestTest.php.
169 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
171 $expected =
'qpl_qst_cloze';
173 $actual = $instance->getAdditionalTableName();
175 $this->assertEquals($expected, $actual);
◆ test_getAnswerTableName_shouldReturnAnswerTableName()
assClozeTestTest::test_getAnswerTableName_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 178 of file assClozeTestTest.php.
181 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
183 $expected = array(
"qpl_a_cloze",
'qpl_a_cloze_combi_res');
185 $actual = $instance->getAnswerTableName();
187 $this->assertEquals($expected, $actual);
◆ test_getQuestionType_shouldReturnQuestionType()
assClozeTestTest::test_getQuestionType_shouldReturnQuestionType |
( |
| ) |
|
Definition at line 141 of file assClozeTestTest.php.
144 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
146 $expected =
'assClozeTest';
148 $actual = $instance->getQuestionType();
150 $this->assertEquals($expected, $actual);
◆ test_instantiateObject_shouldReturnInstance()
assClozeTestTest::test_instantiateObject_shouldReturnInstance |
( |
| ) |
|
Definition at line 43 of file assClozeTestTest.php.
46 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
51 $this->assertInstanceOf(
'assClozeTest', $instance);
◆ test_isComplete_shouldReturnFalseIfIncomplete()
assClozeTestTest::test_isComplete_shouldReturnFalseIfIncomplete |
( |
| ) |
|
Definition at line 67 of file assClozeTestTest.php.
70 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
74 $actual = $instance->isComplete();
76 $this->assertEquals($expected, $actual);
◆ test_setGetEndTag_defaultShoulBeApplied()
assClozeTestTest::test_setGetEndTag_defaultShoulBeApplied |
( |
| ) |
|
Definition at line 123 of file assClozeTestTest.php.
126 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
128 $alternate_tag =
'</gappo_the_great>';
129 $expected =
'[/gap]';
131 $instance->setEndTag($alternate_tag);
132 $intermediate = $instance->getEndTag();
133 $this->assertEquals($alternate_tag, $intermediate);
135 $instance->setEndTag();
136 $actual = $instance->getEndTag();
138 $this->assertEquals($expected, $actual);
◆ test_setGetEndTag_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetEndTag_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 110 of file assClozeTestTest.php.
113 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
115 $expected =
'</gappo_the_great>';
117 $instance->setEndTag($expected);
118 $actual = $instance->getEndTag();
120 $this->assertEquals($expected, $actual);
◆ test_setGetFixedTextLength_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetFixedTextLength_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 190 of file assClozeTestTest.php.
193 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
197 $instance->setFixedTextLength($expected);
198 $actual = $instance->getFixedTextLength();
200 $this->assertEquals($expected, $actual);
◆ test_setGetIdenticalScoring_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetIdenticalScoring_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 153 of file assClozeTestTest.php.
156 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
160 $instance->setIdenticalScoring(
true);
161 $actual = $instance->getIdenticalScoring();
163 $this->assertEquals($expected, $actual);
◆ test_setGetStartTag_defaultShoulBeApplied()
assClozeTestTest::test_setGetStartTag_defaultShoulBeApplied |
( |
| ) |
|
Definition at line 92 of file assClozeTestTest.php.
95 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
97 $alternate_tag =
'<gappo_the_great>';
100 $instance->setStartTag($alternate_tag);
101 $intermediate = $instance->getStartTag();
102 $this->assertEquals($alternate_tag, $intermediate);
104 $instance->setStartTag();
105 $actual = $instance->getStartTag();
107 $this->assertEquals($expected, $actual);
◆ test_setGetStartTag_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetStartTag_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 79 of file assClozeTestTest.php.
82 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
84 $expected =
'<gappo_the_great>';
86 $instance->setStartTag($expected);
87 $actual = $instance->getStartTag();
89 $this->assertEquals($expected, $actual);
◆ $backupGlobals
assClozeTestTest::$backupGlobals = false |
|
protected |
The documentation for this class was generated from the following file: