ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assAnswerClozeTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
13  protected $backupGlobals = FALSE;
14 
15  protected function setUp()
16  {
17  if (defined('ILIAS_PHPUNIT_CONTEXT'))
18  {
19  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
20  ilUnitUtil::performInitialisation();
21  }
22  else
23  {
24  chdir( dirname( __FILE__ ) );
25  chdir('../../../');
26  }
27  }
28 
30  {
31  // Arrange
32  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
33 
34  // Act
35  $instance = new assAnswerCloze();
36 
37  // Assert
38  $this->assertNotNull($instance);
39  }
40 
41  public function test_setGetLowerBound()
42  {
43  // Arrange
44  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
45  $instance = new assAnswerCloze('2');
46 
47  // Act
48  $expected = '1';
49  $instance->setLowerBound($expected);
50  $actual = $instance->getLowerBound();
51 
52  // Assert
53  $this->assertEquals($expected, $actual);
54  }
55 
57  {
58  // Arrange
59  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
60  $instance = new assAnswerCloze('2');
61 
62  // Act
63  $expected = '2';
64  $instance->setLowerBound(4);
65  $actual = $instance->getLowerBound();
66 
67  // Assert
68  $this->assertEquals($expected, $actual);
69  }
70 
72  {
73  // Arrange
74  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
75  $instance = new assAnswerCloze('2');
76 
77  // Act
78  $expected = '2';
79  $instance->setLowerBound('test');
80  $actual = $instance->getLowerBound();
81 
82  // Assert
83  $this->assertEquals($expected, $actual);
84  }
85 
86  public function test_setGetUpperBound()
87  {
88  // Arrange
89  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
90  $instance = new assAnswerCloze('1');
91 
92  // Act
93  $expected = '3';
94  $instance->setUpperBound($expected);
95  $actual = $instance->getUpperBound();
96 
97  // Assert
98  $this->assertEquals($expected, $actual);
99  }
100 
102  {
103  // Arrange
104  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
105  $instance = new assAnswerCloze('4');
106 
107  // Act
108  $expected = '4';
109  $instance->setUpperBound(2);
110  $actual = $instance->getUpperBound();
111 
112  // Assert
113  $this->assertEquals($expected, $actual);
114  }
115 
117  {
118  // Arrange
119  require_once './Modules/TestQuestionPool/classes/class.assAnswerCloze.php';
120  $instance = new assAnswerCloze('4');
121 
122  // Act
123  $expected = '4';
124  $instance->setUpperBound('test');
125  $actual = $instance->getUpperBound();
126 
127  // Assert
128  $this->assertEquals($expected, $actual);
129  }
130 }