ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 setGlobalVariable (string $name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 

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

Definition at line 30 of file assClozeTestTest.php.

References assBaseTestCase\getDatabaseMock(), assBaseTestCase\getGlobalTemplateMock(), assBaseTestCase\getIliasMock(), and assBaseTestCase\setGlobalVariable().

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')->will($this->returnValue('Test'));
46  $this->setGlobalVariable('lng', $lng_mock);
47 
48  $this->setGlobalVariable('ilias', $this->getIliasMock());
49  $this->setGlobalVariable('tpl', $this->getGlobalTemplateMock());
50  $this->setGlobalVariable('ilDB', $this->getDatabaseMock());
51  }
setGlobalVariable(string $name, $value)
+ Here is the call graph for this function:

◆ test_cleanQuestionText_shouldReturnCleanedText()

assClozeTestTest::test_cleanQuestionText_shouldReturnCleanedText ( )

Definition at line 64 of file assClozeTestTest.php.

64  : void
65  {
66  // Arrange
67  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
68  $instance = new assClozeTest();
69  $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 />';
70  $expected = 'Ein [gap]Männlein[/gap] steht [gap]im[/gap] <b>Walde</b> ganz [gap]still[/gap] und [gap]stumm[/gap]<hr />';
71 
72  $actual = $instance->cleanQuestiontext($in_text);
73 
74  $this->assertEquals($expected, $actual);
75  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getAdditionalTableName_shouldReturnAdditionalTableName()

assClozeTestTest::test_getAdditionalTableName_shouldReturnAdditionalTableName ( )

Definition at line 176 of file assClozeTestTest.php.

176  : void
177  {
178  // Arrange
179  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
180  $instance = new assClozeTest();
181  $expected = 'qpl_qst_cloze';
182 
183  $actual = $instance->getAdditionalTableName();
184 
185  $this->assertEquals($expected, $actual);
186  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getAnswerTableName_shouldReturnAnswerTableName()

assClozeTestTest::test_getAnswerTableName_shouldReturnAnswerTableName ( )

Definition at line 188 of file assClozeTestTest.php.

188  : void
189  {
190  // Arrange
191  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
192  $instance = new assClozeTest();
193  $expected = array("qpl_a_cloze",'qpl_a_cloze_combi_res');
194 
195  $actual = $instance->getAnswerTableName();
196 
197  $this->assertEquals($expected, $actual);
198  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_getQuestionType_shouldReturnQuestionType()

assClozeTestTest::test_getQuestionType_shouldReturnQuestionType ( )

Definition at line 151 of file assClozeTestTest.php.

151  : void
152  {
153  // Arrange
154  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
155  $instance = new assClozeTest();
156  $expected = 'assClozeTest';
157 
158  $actual = $instance->getQuestionType();
159 
160  $this->assertEquals($expected, $actual);
161  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_instantiateObject_shouldReturnInstance()

assClozeTestTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 53 of file assClozeTestTest.php.

53  : void
54  {
55  // Arrange
56  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
57 
58  // Act
59  $instance = new assClozeTest();
60 
61  $this->assertInstanceOf('assClozeTest', $instance);
62  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_isComplete_shouldReturnFalseIfIncomplete()

assClozeTestTest::test_isComplete_shouldReturnFalseIfIncomplete ( )

Definition at line 77 of file assClozeTestTest.php.

77  : void
78  {
79  // Arrange
80  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
81  $instance = new assClozeTest();
82  $expected = false;
83 
84  $actual = $instance->isComplete();
85 
86  $this->assertEquals($expected, $actual);
87  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetEndTag_defaultShoulBeApplied()

assClozeTestTest::test_setGetEndTag_defaultShoulBeApplied ( )

Definition at line 133 of file assClozeTestTest.php.

133  : void
134  {
135  // Arrange
136  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
137  $instance = new assClozeTest();
138  $alternate_tag = '</gappo_the_great>';
139  $expected = '[/gap]';
140 
141  $instance->setEndTag($alternate_tag);
142  $intermediate = $instance->getEndTag();
143  $this->assertEquals($alternate_tag, $intermediate);
144 
145  $instance->setEndTag();
146  $actual = $instance->getEndTag();
147 
148  $this->assertEquals($expected, $actual);
149  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetEndTag_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetEndTag_shouldReturnValueUnchanged ( )

Definition at line 120 of file assClozeTestTest.php.

120  : void
121  {
122  // Arrange
123  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
124  $instance = new assClozeTest();
125  $expected = '</gappo_the_great>';
126 
127  $instance->setEndTag($expected);
128  $actual = $instance->getEndTag();
129 
130  $this->assertEquals($expected, $actual);
131  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetFixedTextLength_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetFixedTextLength_shouldReturnValueUnchanged ( )

Definition at line 200 of file assClozeTestTest.php.

200  : void
201  {
202  // Arrange
203  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
204  $instance = new assClozeTest();
205  $expected = 123;
206 
207  $instance->setFixedTextLength($expected);
208  $actual = $instance->getFixedTextLength();
209 
210  $this->assertEquals($expected, $actual);
211  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetIdenticalScoring_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetIdenticalScoring_shouldReturnValueUnchanged ( )

Definition at line 163 of file assClozeTestTest.php.

163  : void
164  {
165  // Arrange
166  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
167  $instance = new assClozeTest();
168  $expected = 1;
169 
170  $instance->setIdenticalScoring(true);
171  $actual = $instance->getIdenticalScoring();
172 
173  $this->assertEquals($expected, $actual);
174  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetStartTag_defaultShoulBeApplied()

assClozeTestTest::test_setGetStartTag_defaultShoulBeApplied ( )

Definition at line 102 of file assClozeTestTest.php.

102  : void
103  {
104  // Arrange
105  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
106  $instance = new assClozeTest();
107  $alternate_tag = '<gappo_the_great>';
108  $expected = '[gap]';
109 
110  $instance->setStartTag($alternate_tag);
111  $intermediate = $instance->getStartTag();
112  $this->assertEquals($alternate_tag, $intermediate);
113 
114  $instance->setStartTag();
115  $actual = $instance->getStartTag();
116 
117  $this->assertEquals($expected, $actual);
118  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_setGetStartTag_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetStartTag_shouldReturnValueUnchanged ( )

Definition at line 89 of file assClozeTestTest.php.

89  : void
90  {
91  // Arrange
92  require_once './Modules/TestQuestionPool/classes/class.assClozeTest.php';
93  $instance = new assClozeTest();
94  $expected = '<gappo_the_great>';
95 
96  $instance->setStartTag($expected);
97  $actual = $instance->getStartTag();
98 
99  $this->assertEquals($expected, $actual);
100  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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: