ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19  ilUnitUtil::performInitialisation();
20  } else {
21  chdir(dirname(__FILE__));
22  chdir('../../../');
23  }
24  }
25 
27  {
28  // Arrange
29  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
30 
31  // Act
32  $instance = new ASS_AnswerBinaryState();
33 
34  $this->assertInstanceOf('ASS_AnswerBinaryState', $instance);
35  }
36 
38  {
39  // Arrange
40  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
41  $instance = new ASS_AnswerBinaryState();
42  $expected = 1;
43 
44  // Act
45  $instance->setState($expected);
46  $actual = $instance->getState();
47 
48  // Assert
49  $this->assertEquals($expected, $actual);
50  }
51 
53  {
54  // Arrange
55  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
56  $instance = new ASS_AnswerBinaryState();
57  $expected = 1;
58 
59  // Act
60  $instance->setState($expected);
61  $actual = $instance->isStateChecked();
62 
63  // Assert
64  $this->assertEquals($expected, $actual);
65  }
66 
68  {
69  // Arrange
70  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
71  $instance = new ASS_AnswerBinaryState();
72  $expected = 1;
73 
74  // Act
75  $instance->setState($expected);
76  $actual = $instance->isStateSet();
77 
78  // Assert
79  $this->assertEquals($expected, $actual);
80  }
81 
83  {
84  // Arrange
85  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
86  $instance = new ASS_AnswerBinaryState();
87  $expected = 1;
88 
89  // Act
90  $instance->setState($expected);
91  $actual = !$instance->isStateUnset();
92 
93  // Assert
94  $this->assertEquals($expected, $actual);
95  }
96 
98  {
99  // Arrange
100  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
101  $instance = new ASS_AnswerBinaryState();
102  $expected = 1;
103 
104  // Act
105  $instance->setState($expected);
106  $actual = !$instance->isStateUnchecked();
107 
108  // Assert
109  $this->assertEquals($expected, $actual);
110  }
111 
113  {
114  // Arrange
115  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
116  $instance = new ASS_AnswerBinaryState();
117  $expected = 0;
118  $instance->setState($expected);
119 
120  // Act
121  $instance->setChecked();
122  $actual = $instance->isStateUnchecked();
123 
124  // Assert
125  $this->assertEquals($expected, $actual);
126  }
127 
129  {
130  // Arrange
131  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
132  $instance = new ASS_AnswerBinaryState();
133  $expected = 1;
134  $instance->setState($expected);
135 
136  // Act
137  $instance->setUnchecked();
138  $actual = $instance->isStateUnchecked();
139 
140  // Assert
141  $this->assertEquals($expected, $actual);
142  }
143 
145  {
146  // Arrange
147  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
148  $instance = new ASS_AnswerBinaryState();
149  $expected = 0;
150  $instance->setState($expected);
151 
152  // Act
153  $instance->setSet();
154  $actual = $instance->isStateUnchecked();
155 
156  // Assert
157  $this->assertEquals($expected, $actual);
158  }
159 
161  {
162  // Arrange
163  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
164  $instance = new ASS_AnswerBinaryState();
165  $expected = 1;
166  $instance->setState($expected);
167 
168  // Act
169  $instance->setUnset();
170  $actual = $instance->isStateUnchecked();
171 
172  // Assert
173  $this->assertEquals($expected, $actual);
174  }
175 }
Class for true/false or yes/no answers.