ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
assClozeTestTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assClozeTestTest:
+ Collaboration diagram for assClozeTestTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_cleanQuestionText_shouldReturnCleanedText ()
 
 test_isComplete_shouldReturnFalseIfIncomplete ()
 
 test_setGetStartTag_shouldReturnValueUnchanged ()
 
 test_setGetStartTag_defaultShoulBeApplied ()
 
 test_setGetEndTag_shouldReturnValueUnchanged ()
 
 test_setGetEndTag_defaultShoulBeApplied ()
 
 test_getQuestionType_shouldReturnQuestionType ()
 
 test_setGetIdenticalScoring_shouldReturnValueUnchanged ()
 
 test_getAdditionalTableName_shouldReturnAdditionalTableName ()
 
 test_getAnswerTableName_shouldReturnAnswerTableName ()
 
 test_setGetFixedTextLength_shouldReturnValueUnchanged ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from assBaseTestCase
 setUp ()
 
 tearDown ()
 
 getIRSSMock ()
 

Protected Attributes

 $backupGlobals = false
 
- Protected Attributes inherited from assBaseTestCase
Container $dic = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Unit tests

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

\

Definition at line 26 of file assClozeTestTest.php.

Member Function Documentation

◆ setUp()

assClozeTestTest::setUp ( )
protected

Reimplemented from assBaseTestCase.

Definition at line 30 of file assClozeTestTest.php.

30 : void
31 {
32 parent::setUp();
33
34 $ilCtrl_mock = $this->getMockBuilder(ilCtrl::class)
35 ->disableOriginalConstructor()
36 ->getMock();
37 $ilCtrl_mock->method('saveParameter');
38 $ilCtrl_mock->method('saveParameterByClass');
39 $this->setGlobalVariable('ilCtrl', $ilCtrl_mock);
40
41 $lng_mock = $this->getMockBuilder(ilLanguage::class)
42 ->disableOriginalConstructor()
43 ->onlyMethods(['txt'])
44 ->getMock();
45 $lng_mock->method('txt')->willReturn('Test');
46 $this->setGlobalVariable('lng', $lng_mock);
47
48 $this->setGlobalVariable('ilias', $this->getIliasMock());
49 $this->setGlobalVariable('ilDB', $this->getDatabaseMock());
50 }
setGlobalVariable(string $name, mixed $value)

References getDatabaseMock(), getIliasMock(), and setGlobalVariable().

+ Here is the call graph for this function:

◆ test_cleanQuestionText_shouldReturnCleanedText()

assClozeTestTest::test_cleanQuestionText_shouldReturnCleanedText ( )

Definition at line 59 of file assClozeTestTest.php.

59 : void
60 {
61 $instance = new assClozeTest();
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 />';
64
65 $actual = $instance->cleanQuestiontext($in_text);
66
67 $this->assertEquals($expected, $actual);
68 }
Class for cloze tests.

◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()

assClozeTestTest::test_getAdditionalTableName_shouldReturnAdditionalTableName ( )

Definition at line 155 of file assClozeTestTest.php.

155 : void
156 {
157 $instance = new assClozeTest();
158 $expected = 'qpl_qst_cloze';
159
160 $actual = $instance->getAdditionalTableName();
161
162 $this->assertEquals($expected, $actual);
163 }

◆ test_getAnswerTableName_shouldReturnAnswerTableName()

assClozeTestTest::test_getAnswerTableName_shouldReturnAnswerTableName ( )

Definition at line 165 of file assClozeTestTest.php.

165 : void
166 {
167 $instance = new assClozeTest();
168 $expected = ["qpl_a_cloze",'qpl_a_cloze_combi_res'];
169
170 $actual = $instance->getAnswerTableName();
171
172 $this->assertEquals($expected, $actual);
173 }

◆ test_getQuestionType_shouldReturnQuestionType()

assClozeTestTest::test_getQuestionType_shouldReturnQuestionType ( )

Definition at line 134 of file assClozeTestTest.php.

134 : void
135 {
136 $instance = new assClozeTest();
137 $expected = 'assClozeTest';
138
139 $actual = $instance->getQuestionType();
140
141 $this->assertEquals($expected, $actual);
142 }

◆ test_instantiateObject_shouldReturnInstance()

assClozeTestTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 52 of file assClozeTestTest.php.

52 : void
53 {
54 $instance = new assClozeTest();
55
56 $this->assertInstanceOf(assClozeTest::class, $instance);
57 }

◆ test_isComplete_shouldReturnFalseIfIncomplete()

assClozeTestTest::test_isComplete_shouldReturnFalseIfIncomplete ( )

Definition at line 70 of file assClozeTestTest.php.

70 : void
71 {
72 $instance = new assClozeTest();
73 $expected = false;
74
75 $actual = $instance->isComplete();
76
77 $this->assertEquals($expected, $actual);
78 }

◆ test_setGetEndTag_defaultShoulBeApplied()

assClozeTestTest::test_setGetEndTag_defaultShoulBeApplied ( )

Definition at line 118 of file assClozeTestTest.php.

118 : void
119 {
120 $instance = new assClozeTest();
121 $alternate_tag = '</gappo_the_great>';
122 $expected = '[/gap]';
123
124 $instance->setEndTag($alternate_tag);
125 $intermediate = $instance->getEndTag();
126 $this->assertEquals($alternate_tag, $intermediate);
127
128 $instance->setEndTag();
129 $actual = $instance->getEndTag();
130
131 $this->assertEquals($expected, $actual);
132 }

◆ test_setGetEndTag_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetEndTag_shouldReturnValueUnchanged ( )

Definition at line 107 of file assClozeTestTest.php.

107 : void
108 {
109 $instance = new assClozeTest();
110 $expected = '</gappo_the_great>';
111
112 $instance->setEndTag($expected);
113 $actual = $instance->getEndTag();
114
115 $this->assertEquals($expected, $actual);
116 }

◆ test_setGetFixedTextLength_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetFixedTextLength_shouldReturnValueUnchanged ( )

Definition at line 175 of file assClozeTestTest.php.

175 : void
176 {
177 $instance = new assClozeTest();
178 $expected = 123;
179
180 $instance->setFixedTextLength($expected);
181 $actual = $instance->getFixedTextLength();
182
183 $this->assertEquals($expected, $actual);
184 }

◆ test_setGetIdenticalScoring_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetIdenticalScoring_shouldReturnValueUnchanged ( )

Definition at line 144 of file assClozeTestTest.php.

144 : void
145 {
146 $instance = new assClozeTest();
147 $expected = 1;
148
149 $instance->setIdenticalScoring(true);
150 $actual = $instance->getIdenticalScoring();
151
152 $this->assertEquals($expected, $actual);
153 }

◆ test_setGetStartTag_defaultShoulBeApplied()

assClozeTestTest::test_setGetStartTag_defaultShoulBeApplied ( )

Definition at line 91 of file assClozeTestTest.php.

91 : void
92 {
93 $instance = new assClozeTest();
94 $alternate_tag = '<gappo_the_great>';
95 $expected = '[gap]';
96
97 $instance->setStartTag($alternate_tag);
98 $intermediate = $instance->getStartTag();
99 $this->assertEquals($alternate_tag, $intermediate);
100
101 $instance->setStartTag();
102 $actual = $instance->getStartTag();
103
104 $this->assertEquals($expected, $actual);
105 }

◆ test_setGetStartTag_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetStartTag_shouldReturnValueUnchanged ( )

Definition at line 80 of file assClozeTestTest.php.

80 : void
81 {
82 $instance = new assClozeTest();
83 $expected = '<gappo_the_great>';
84
85 $instance->setStartTag($expected);
86 $actual = $instance->getStartTag();
87
88 $this->assertEquals($expected, $actual);
89 }

Field Documentation

◆ $backupGlobals

assClozeTestTest::$backupGlobals = false
protected

Definition at line 28 of file assClozeTestTest.php.


The documentation for this class was generated from the following file: