30 protected function setUp(): void
34 $ilCtrl_mock = $this->getMockBuilder(ilCtrl::class)
35 ->disableOriginalConstructor()
37 $ilCtrl_mock->method(
'saveParameter');
38 $ilCtrl_mock->method(
'saveParameterByClass');
39 $this->setGlobalVariable(
'ilCtrl', $ilCtrl_mock);
41 $lng_mock = $this->getMockBuilder(ilLanguage::class)
42 ->disableOriginalConstructor()
43 ->onlyMethods([
'txt'])
45 $lng_mock->method(
'txt')->will($this->returnValue(
'Test'));
46 $this->setGlobalVariable(
'lng', $lng_mock);
48 $this->setGlobalVariable(
'ilias', $this->getIliasMock());
49 $this->setGlobalVariable(
'ilDB', $this->getDatabaseMock());
56 $this->assertInstanceOf(assClozeTest::class, $instance);
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);
75 $actual = $instance->isComplete();
77 $this->assertEquals($expected, $actual);
83 $expected =
'<gappo_the_great>';
85 $instance->setStartTag($expected);
86 $actual = $instance->getStartTag();
88 $this->assertEquals($expected, $actual);
94 $alternate_tag =
'<gappo_the_great>';
97 $instance->setStartTag($alternate_tag);
98 $intermediate = $instance->getStartTag();
99 $this->assertEquals($alternate_tag, $intermediate);
101 $instance->setStartTag();
102 $actual = $instance->getStartTag();
104 $this->assertEquals($expected, $actual);
110 $expected =
'</gappo_the_great>';
112 $instance->setEndTag($expected);
113 $actual = $instance->getEndTag();
115 $this->assertEquals($expected, $actual);
121 $alternate_tag =
'</gappo_the_great>';
122 $expected =
'[/gap]';
124 $instance->setEndTag($alternate_tag);
125 $intermediate = $instance->getEndTag();
126 $this->assertEquals($alternate_tag, $intermediate);
128 $instance->setEndTag();
129 $actual = $instance->getEndTag();
131 $this->assertEquals($expected, $actual);
137 $expected =
'assClozeTest';
139 $actual = $instance->getQuestionType();
141 $this->assertEquals($expected, $actual);
149 $instance->setIdenticalScoring(
true);
150 $actual = $instance->getIdenticalScoring();
152 $this->assertEquals($expected, $actual);
158 $expected =
'qpl_qst_cloze';
160 $actual = $instance->getAdditionalTableName();
162 $this->assertEquals($expected, $actual);
168 $expected = [
"qpl_a_cloze",
'qpl_a_cloze_combi_res'];
170 $actual = $instance->getAnswerTableName();
172 $this->assertEquals($expected, $actual);
180 $instance->setFixedTextLength($expected);
181 $actual = $instance->getFixedTextLength();
183 $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()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_setGetStartTag_shouldReturnValueUnchanged()
test_setGetEndTag_shouldReturnValueUnchanged()