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';
49 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
54 $this->assertInstanceOf(
'assClozeTest', $instance);
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);
73 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
77 $actual = $instance->isComplete();
79 $this->assertEquals($expected, $actual);
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);
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);
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);
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);
147 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
149 $expected =
'assClozeTest';
151 $actual = $instance->getQuestionType();
153 $this->assertEquals($expected, $actual);
159 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
163 $instance->setIdenticalScoring(
true);
164 $actual = $instance->getIdenticalScoring();
166 $this->assertEquals($expected, $actual);
172 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
174 $expected =
'qpl_qst_cloze';
176 $actual = $instance->getAdditionalTableName();
178 $this->assertEquals($expected, $actual);
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);
196 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
200 $instance->setFixedTextLength($expected);
201 $actual = $instance->getFixedTextLength();
203 $this->assertEquals($expected, $actual);
test_instantiateObject_shouldReturnInstance()
test_isComplete_shouldReturnFalseIfIncomplete()
test_setGetFixedTextLength_shouldReturnValueUnchanged()
test_getAdditionalTableName_shouldReturnAdditionalTableName()
test_getQuestionType_shouldReturnQuestionType()
test_setGetIdenticalScoring_shouldReturnValueUnchanged()
test_getAnswerTableName_shouldReturnAnswerTableName()
test_cleanQuestionText_shouldReturnCleanedText()
test_setGetEndTag_defaultShoulBeApplied()
test_setGetStartTag_defaultShoulBeApplied()
test_setGetStartTag_shouldReturnValueUnchanged()
Create styles array
The data for the language used.
test_setGetEndTag_shouldReturnValueUnchanged()
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'