17 if (defined(
'ILIAS_PHPUNIT_CONTEXT'))
19 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
20 ilUnitUtil::performInitialisation();
24 chdir( dirname( __FILE__ ) );
27 require_once
'./Services/UICore/classes/class.ilCtrl.php';
28 $ilCtrl_mock = $this->getMock(
'ilCtrl');
29 $ilCtrl_mock->expects( $this->any() )->method(
'saveParameter' );
30 $ilCtrl_mock->expects( $this->any() )->method(
'saveParameterByClass' );
32 $ilCtrl = $ilCtrl_mock;
34 require_once
'./Services/Language/classes/class.ilLanguage.php';
35 $lng_mock = $this->getMock(
'ilLanguage', array(
'txt'), array(),
'',
false);
40 $ilias_mock =
new stdClass();
41 $ilias_mock->account =
new stdClass();
42 $ilias_mock->account->id = 6;
43 $ilias_mock->account->fullname =
'Esther Tester';
52 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
57 $this->assertInstanceOf(
'assClozeTest', $instance);
63 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
65 $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 />';
66 $expected =
'Ein [gap]Männlein[/gap] steht [gap]im[/gap] <b>Walde</b> ganz [gap]still[/gap] und [gap]stumm[/gap]<hr />';
68 $actual = $instance->cleanQuestiontext($in_text);
70 $this->assertEquals($expected, $actual);
76 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
80 $actual = $instance->isComplete();
82 $this->assertEquals($expected, $actual);
88 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
90 $expected =
'<gappo_the_great>';
92 $instance->setStartTag($expected);
93 $actual = $instance->getStartTag();
95 $this->assertEquals($expected, $actual);
101 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
103 $alternate_tag =
'<gappo_the_great>';
106 $instance->setStartTag($alternate_tag);
107 $intermediate = $instance->getStartTag();
108 $this->assertEquals($alternate_tag, $intermediate);
110 $instance->setStartTag();
111 $actual = $instance->getStartTag();
113 $this->assertEquals($expected, $actual);
119 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
121 $expected =
'</gappo_the_great>';
123 $instance->setEndTag($expected);
124 $actual = $instance->getEndTag();
126 $this->assertEquals($expected, $actual);
132 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
134 $alternate_tag =
'</gappo_the_great>';
135 $expected =
'[/gap]';
137 $instance->setEndTag($alternate_tag);
138 $intermediate = $instance->getEndTag();
139 $this->assertEquals($alternate_tag, $intermediate);
141 $instance->setEndTag();
142 $actual = $instance->getEndTag();
144 $this->assertEquals($expected, $actual);
150 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
152 $expected =
'assClozeTest';
154 $actual = $instance->getQuestionType();
156 $this->assertEquals($expected, $actual);
162 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
166 $instance->setIdenticalScoring(
true);
167 $actual = $instance->getIdenticalScoring();
169 $this->assertEquals($expected, $actual);
175 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
177 $expected =
'qpl_qst_cloze';
179 $actual = $instance->getAdditionalTableName();
181 $this->assertEquals($expected, $actual);
187 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
189 $expected =
'qpl_a_cloze';
191 $actual = $instance->getAnswerTableName();
193 $this->assertEquals($expected, $actual);
199 require_once
'./Modules/TestQuestionPool/classes/class.assClozeTest.php';
203 $instance->setFixedTextLength($expected);
204 $actual = $instance->getFixedTextLength();
206 $this->assertEquals($expected, $actual);