ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assClozeSelectGapTest Class Reference

Unit tests. More...

+ Inheritance diagram for assClozeSelectGapTest:
+ Collaboration diagram for assClozeSelectGapTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_newlyInstatiatedObject_shouldReturnTrueOnGetShuffle ()
 
 test_arrayShuffle_shouldShuffleArray ()
 
 test_getItemswithShuffle_shouldReturnShuffledItems ()
 
 test_getItemswithoutShuffle_shouldReturnItemsInOrder ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

Unit tests.

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

Definition at line 11 of file assClozeSelectGapTest.php.

Member Function Documentation

◆ setUp()

assClozeSelectGapTest::setUp ( )
protected

Definition at line 15 of file assClozeSelectGapTest.php.

References defined.

16  {
17  if (defined('ILIAS_PHPUNIT_CONTEXT')) {
18  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19  ilUnitUtil::performInitialisation();
20  } else {
21  chdir(dirname(__FILE__));
22  chdir('../../../');
23  }
24  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ test_arrayShuffle_shouldShuffleArray()

assClozeSelectGapTest::test_arrayShuffle_shouldShuffleArray ( )

Definition at line 49 of file assClozeSelectGapTest.php.

References array.

50  {
51  // Arrange
52  require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
53  $instance = new assClozeSelectGap(1); // 1 - select gap
54  $expected = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
55 
56  $actual = $instance->getItems(new ilArrayElementShuffler());
57  $this->assertNotEquals($expected, $actual);
58  }
Class for cloze question select gaps.
Create styles array
The data for the language used.

◆ test_getItemswithoutShuffle_shouldReturnItemsInOrder()

assClozeSelectGapTest::test_getItemswithoutShuffle_shouldReturnItemsInOrder ( )

Definition at line 93 of file assClozeSelectGapTest.php.

References array.

94  {
95  require_once 'Services/Randomization/classes/class.ilArrayElementOrderKeeper.php';
96  require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
97  $instance = new assClozeSelectGap(1); // 1 - select gap
98 
99  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
100  $item1 = new assAnswerCloze('Bert', 1.0, 0);
101  $item2 = new assAnswerCloze('Fred', 2.0, 1);
102  $item3 = new assAnswerCloze('Karl', 4, 2);
103  $item4 = new assAnswerCloze('Esther', 4, 3);
104 
105  $instance->addItem($item1);
106  $instance->addItem($item2);
107  $instance->addItem($item3);
108  $instance->addItem($item4);
109 
110  $instance->setType(false);
111 
112  $expected = array($item1, $item2, $item3, $item4);
113  $actual = $instance->getItems(new ilArrayElementOrderKeeper());
114 
115  $this->assertEquals($expected, $actual);
116  }
Class for cloze question numeric answers.
Class for cloze question select gaps.
Create styles array
The data for the language used.

◆ test_getItemswithShuffle_shouldReturnShuffledItems()

assClozeSelectGapTest::test_getItemswithShuffle_shouldReturnShuffledItems ( )

Definition at line 60 of file assClozeSelectGapTest.php.

References array.

61  {
62  require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
63  $instance = new assClozeSelectGap(1); // 1 - select gap
64 
65  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
66  $item1 = new assAnswerCloze('Bert', 1.0, 0);
67  $item2 = new assAnswerCloze('Fred', 2.0, 2);
68  $item3 = new assAnswerCloze('Karl', 4, 1);
69  $item4 = new assAnswerCloze('Esther', 4, 3);
70  $item5 = new assAnswerCloze('Herbert', 1.0, 4);
71  $item6 = new assAnswerCloze('Karina', 1.0, 5);
72  $item7 = new assAnswerCloze('Helmut', 1.0, 6);
73  $item8 = new assAnswerCloze('Kerstin', 1.0, 7);
74 
75  $instance->addItem($item1);
76  $instance->addItem($item2);
77  $instance->addItem($item3);
78  $instance->addItem($item4);
79  $instance->addItem($item5);
80  $instance->addItem($item6);
81  $instance->addItem($item7);
82  $instance->addItem($item8);
83 
84  $instance->setType(true);
85 
86  $expected = array($item1, $item2, $item3, $item4, $item5, $item6, $item7, $item8);
87 
88  $actual = $instance->getItems(new ilArrayElementShuffler());
89 
90  $this->assertNotEquals($expected, $actual);
91  }
Class for cloze question numeric answers.
Class for cloze question select gaps.
Create styles array
The data for the language used.

◆ test_instantiateObject_shouldReturnInstance()

assClozeSelectGapTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 26 of file assClozeSelectGapTest.php.

27  {
28  // Arrange
29  require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
30 
31  // Act
32  $instance = new assClozeSelectGap(1); // 1 - select gap
33 
34  $this->assertInstanceOf('assClozeSelectGap', $instance);
35  }
Class for cloze question select gaps.

◆ test_newlyInstatiatedObject_shouldReturnTrueOnGetShuffle()

assClozeSelectGapTest::test_newlyInstatiatedObject_shouldReturnTrueOnGetShuffle ( )

Definition at line 37 of file assClozeSelectGapTest.php.

38  {
39  // Arrange
40  require_once './Modules/TestQuestionPool/classes/class.assClozeSelectGap.php';
41  $instance = new assClozeSelectGap(1); // 1 - select gap
42  $expected = true;
43 
44  $actual = $instance->getShuffle();
45 
46  $this->assertEquals($expected, $actual);
47  }
Class for cloze question select gaps.

Field Documentation

◆ $backupGlobals

assClozeSelectGapTest::$backupGlobals = false
protected

Definition at line 13 of file assClozeSelectGapTest.php.


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