ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 getIRSSMock ()
 
 getFileDeliveryMock ()
 
 getIliasMock ()
 
 addGlobal_uiFactory ()
 
 addGlobal_uiRenderer ()
 

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 61 of file assClozeTestTest.php.

61  : void
62  {
63  $instance = new assClozeTest();
64  $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 />';
65  $expected = 'Ein [gap]Männlein[/gap] steht [gap]im[/gap] <b>Walde</b> ganz [gap]still[/gap] und [gap]stumm[/gap]<hr />';
66 
67  $actual = $instance->cleanQuestiontext($in_text);
68 
69  $this->assertEquals($expected, $actual);
70  }
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 157 of file assClozeTestTest.php.

157  : void
158  {
159  $instance = new assClozeTest();
160  $expected = 'qpl_qst_cloze';
161 
162  $actual = $instance->getAdditionalTableName();
163 
164  $this->assertEquals($expected, $actual);
165  }
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 167 of file assClozeTestTest.php.

167  : void
168  {
169  $instance = new assClozeTest();
170  $expected = array("qpl_a_cloze",'qpl_a_cloze_combi_res');
171 
172  $actual = $instance->getAnswerTableName();
173 
174  $this->assertEquals($expected, $actual);
175  }
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 136 of file assClozeTestTest.php.

136  : void
137  {
138  $instance = new assClozeTest();
139  $expected = 'assClozeTest';
140 
141  $actual = $instance->getQuestionType();
142 
143  $this->assertEquals($expected, $actual);
144  }
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  // Act
56  $instance = new assClozeTest();
57 
58  $this->assertInstanceOf('assClozeTest', $instance);
59  }
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 72 of file assClozeTestTest.php.

72  : void
73  {
74  $instance = new assClozeTest();
75  $expected = false;
76 
77  $actual = $instance->isComplete();
78 
79  $this->assertEquals($expected, $actual);
80  }
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 120 of file assClozeTestTest.php.

120  : void
121  {
122  $instance = new assClozeTest();
123  $alternate_tag = '</gappo_the_great>';
124  $expected = '[/gap]';
125 
126  $instance->setEndTag($alternate_tag);
127  $intermediate = $instance->getEndTag();
128  $this->assertEquals($alternate_tag, $intermediate);
129 
130  $instance->setEndTag();
131  $actual = $instance->getEndTag();
132 
133  $this->assertEquals($expected, $actual);
134  }
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 109 of file assClozeTestTest.php.

109  : void
110  {
111  $instance = new assClozeTest();
112  $expected = '</gappo_the_great>';
113 
114  $instance->setEndTag($expected);
115  $actual = $instance->getEndTag();
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_setGetFixedTextLength_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetFixedTextLength_shouldReturnValueUnchanged ( )

Definition at line 177 of file assClozeTestTest.php.

177  : void
178  {
179  $instance = new assClozeTest();
180  $expected = 123;
181 
182  $instance->setFixedTextLength($expected);
183  $actual = $instance->getFixedTextLength();
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_setGetIdenticalScoring_shouldReturnValueUnchanged()

assClozeTestTest::test_setGetIdenticalScoring_shouldReturnValueUnchanged ( )

Definition at line 146 of file assClozeTestTest.php.

146  : void
147  {
148  $instance = new assClozeTest();
149  $expected = 1;
150 
151  $instance->setIdenticalScoring(true);
152  $actual = $instance->getIdenticalScoring();
153 
154  $this->assertEquals($expected, $actual);
155  }
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 93 of file assClozeTestTest.php.

93  : void
94  {
95  $instance = new assClozeTest();
96  $alternate_tag = '<gappo_the_great>';
97  $expected = '[gap]';
98 
99  $instance->setStartTag($alternate_tag);
100  $intermediate = $instance->getStartTag();
101  $this->assertEquals($alternate_tag, $intermediate);
102 
103  $instance->setStartTag();
104  $actual = $instance->getStartTag();
105 
106  $this->assertEquals($expected, $actual);
107  }
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 82 of file assClozeTestTest.php.

82  : void
83  {
84  $instance = new assClozeTest();
85  $expected = '<gappo_the_great>';
86 
87  $instance->setStartTag($expected);
88  $actual = $instance->getStartTag();
89 
90  $this->assertEquals($expected, $actual);
91  }
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: