ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assAnswerBinaryStateTest.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.assAnswerBinaryState.php';
33 
34  // Act
35  $instance = new ASS_AnswerBinaryState();
36 
37  $this->assertInstanceOf('ASS_AnswerBinaryState', $instance);
38  }
39 
41  {
42  // Arrange
43  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
44  $instance = new ASS_AnswerBinaryState();
45  $expected = 1;
46 
47  // Act
48  $instance->setState($expected);
49  $actual = $instance->getState();
50 
51  // Assert
52  $this->assertEquals($expected, $actual);
53  }
54 
56  {
57  // Arrange
58  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
59  $instance = new ASS_AnswerBinaryState();
60  $expected = 1;
61 
62  // Act
63  $instance->setState($expected);
64  $actual = $instance->isStateChecked();
65 
66  // Assert
67  $this->assertEquals($expected, $actual);
68  }
69 
71  {
72  // Arrange
73  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
74  $instance = new ASS_AnswerBinaryState();
75  $expected = 1;
76 
77  // Act
78  $instance->setState($expected);
79  $actual = $instance->isStateSet();
80 
81  // Assert
82  $this->assertEquals($expected, $actual);
83  }
84 
86  {
87  // Arrange
88  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
89  $instance = new ASS_AnswerBinaryState();
90  $expected = 1;
91 
92  // Act
93  $instance->setState($expected);
94  $actual = !$instance->isStateUnset();
95 
96  // Assert
97  $this->assertEquals($expected, $actual);
98  }
99 
101  {
102  // Arrange
103  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
104  $instance = new ASS_AnswerBinaryState();
105  $expected = 1;
106 
107  // Act
108  $instance->setState($expected);
109  $actual = !$instance->isStateUnchecked();
110 
111  // Assert
112  $this->assertEquals($expected, $actual);
113  }
114 
116  {
117  // Arrange
118  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
119  $instance = new ASS_AnswerBinaryState();
120  $expected = 0;
121  $instance->setState($expected);
122 
123  // Act
124  $instance->setChecked();
125  $actual = $instance->isStateUnchecked();
126 
127  // Assert
128  $this->assertEquals($expected, $actual);
129  }
130 
132  {
133  // Arrange
134  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
135  $instance = new ASS_AnswerBinaryState();
136  $expected = 1;
137  $instance->setState($expected);
138 
139  // Act
140  $instance->setUnchecked();
141  $actual = $instance->isStateUnchecked();
142 
143  // Assert
144  $this->assertEquals($expected, $actual);
145  }
146 
148  {
149  // Arrange
150  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
151  $instance = new ASS_AnswerBinaryState();
152  $expected = 0;
153  $instance->setState($expected);
154 
155  // Act
156  $instance->setSet();
157  $actual = $instance->isStateUnchecked();
158 
159  // Assert
160  $this->assertEquals($expected, $actual);
161  }
162 
164  {
165  // Arrange
166  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
167  $instance = new ASS_AnswerBinaryState();
168  $expected = 1;
169  $instance->setState($expected);
170 
171  // Act
172  $instance->setUnset();
173  $actual = $instance->isStateUnchecked();
174 
175  // Assert
176  $this->assertEquals($expected, $actual);
177  }
178 }