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 $ilCtrl, $lng, array, and defined.
17 if (
defined(
'ILIAS_PHPUNIT_CONTEXT')) {
18 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
19 ilUnitUtil::performInitialisation();
21 chdir(dirname(__FILE__));
24 require_once
'./Services/UICore/classes/class.ilCtrl.php';
25 $ilCtrl_mock = $this->createMock(
'ilCtrl');
26 $ilCtrl_mock->expects($this->any())->method(
'saveParameter');
27 $ilCtrl_mock->expects($this->any())->method(
'saveParameterByClass');
29 $ilCtrl = $ilCtrl_mock;
31 require_once
'./Services/Language/classes/class.ilLanguage.php';
32 $lng_mock = $this->createMock(
'ilLanguage',
array(
'txt'),
array(),
'',
false);
37 $ilias_mock =
new stdClass();
38 $ilias_mock->account =
new stdClass();
39 $ilias_mock->account->id = 6;
40 $ilias_mock->account->fullname =
'Esther Tester';
Create styles array
The data for the language used.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
◆ test_cleanQuestionText_shouldReturnCleanedText()
assClozeTestTest::test_cleanQuestionText_shouldReturnCleanedText |
( |
| ) |
|
Definition at line 57 of file assClozeTestTest.php.
60 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
62 $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 />';
63 $expected =
'Ein [gap]Männlein[/gap] steht [gap]im[/gap] <b>Walde</b> ganz [gap]still[/gap] und [gap]stumm[/gap]<hr />';
65 $actual = $instance->cleanQuestiontext($in_text);
67 $this->assertEquals($expected, $actual);
◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()
assClozeTestTest::test_getAdditionalTableName_shouldReturnAdditionalTableName |
( |
| ) |
|
Definition at line 169 of file assClozeTestTest.php.
172 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
174 $expected =
'qpl_qst_cloze';
176 $actual = $instance->getAdditionalTableName();
178 $this->assertEquals($expected, $actual);
◆ test_getAnswerTableName_shouldReturnAnswerTableName()
assClozeTestTest::test_getAnswerTableName_shouldReturnAnswerTableName |
( |
| ) |
|
Definition at line 181 of file assClozeTestTest.php.
References array.
184 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
186 $expected =
array(
"qpl_a_cloze",
'qpl_a_cloze_combi_res');
188 $actual = $instance->getAnswerTableName();
190 $this->assertEquals($expected, $actual);
Create styles array
The data for the language used.
◆ test_getQuestionType_shouldReturnQuestionType()
assClozeTestTest::test_getQuestionType_shouldReturnQuestionType |
( |
| ) |
|
Definition at line 144 of file assClozeTestTest.php.
147 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
149 $expected =
'assClozeTest';
151 $actual = $instance->getQuestionType();
153 $this->assertEquals($expected, $actual);
◆ test_instantiateObject_shouldReturnInstance()
assClozeTestTest::test_instantiateObject_shouldReturnInstance |
( |
| ) |
|
Definition at line 46 of file assClozeTestTest.php.
49 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
54 $this->assertInstanceOf(
'assClozeTest', $instance);
◆ test_isComplete_shouldReturnFalseIfIncomplete()
assClozeTestTest::test_isComplete_shouldReturnFalseIfIncomplete |
( |
| ) |
|
Definition at line 70 of file assClozeTestTest.php.
73 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
77 $actual = $instance->isComplete();
79 $this->assertEquals($expected, $actual);
◆ test_setGetEndTag_defaultShoulBeApplied()
assClozeTestTest::test_setGetEndTag_defaultShoulBeApplied |
( |
| ) |
|
Definition at line 126 of file assClozeTestTest.php.
129 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
131 $alternate_tag =
'</gappo_the_great>';
132 $expected =
'[/gap]';
134 $instance->setEndTag($alternate_tag);
135 $intermediate = $instance->getEndTag();
136 $this->assertEquals($alternate_tag, $intermediate);
138 $instance->setEndTag();
139 $actual = $instance->getEndTag();
141 $this->assertEquals($expected, $actual);
◆ test_setGetEndTag_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetEndTag_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 113 of file assClozeTestTest.php.
116 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
118 $expected =
'</gappo_the_great>';
120 $instance->setEndTag($expected);
121 $actual = $instance->getEndTag();
123 $this->assertEquals($expected, $actual);
◆ test_setGetFixedTextLength_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetFixedTextLength_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 193 of file assClozeTestTest.php.
196 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
200 $instance->setFixedTextLength($expected);
201 $actual = $instance->getFixedTextLength();
203 $this->assertEquals($expected, $actual);
◆ test_setGetIdenticalScoring_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetIdenticalScoring_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 156 of file assClozeTestTest.php.
159 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
163 $instance->setIdenticalScoring(
true);
164 $actual = $instance->getIdenticalScoring();
166 $this->assertEquals($expected, $actual);
◆ test_setGetStartTag_defaultShoulBeApplied()
assClozeTestTest::test_setGetStartTag_defaultShoulBeApplied |
( |
| ) |
|
Definition at line 95 of file assClozeTestTest.php.
98 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
100 $alternate_tag =
'<gappo_the_great>';
103 $instance->setStartTag($alternate_tag);
104 $intermediate = $instance->getStartTag();
105 $this->assertEquals($alternate_tag, $intermediate);
107 $instance->setStartTag();
108 $actual = $instance->getStartTag();
110 $this->assertEquals($expected, $actual);
◆ test_setGetStartTag_shouldReturnValueUnchanged()
assClozeTestTest::test_setGetStartTag_shouldReturnValueUnchanged |
( |
| ) |
|
Definition at line 82 of file assClozeTestTest.php.
85 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
87 $expected =
'<gappo_the_great>';
89 $instance->setStartTag($expected);
90 $actual = $instance->getStartTag();
92 $this->assertEquals($expected, $actual);
◆ $backupGlobals
assClozeTestTest::$backupGlobals = false |
|
protected |
The documentation for this class was generated from the following file: