ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
assAnswerBinaryStateTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
32 {
33  protected $backupGlobals = FALSE;
34 
35  protected function setUp()
36  {
37  if (defined('ILIAS_PHPUNIT_CONTEXT'))
38  {
39  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
40  ilUnitUtil::performInitialisation();
41  }
42  else
43  {
44  chdir( dirname( __FILE__ ) );
45  chdir('../../../');
46  }
47  }
48 
50  {
51  // Arrange
52  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
53 
54  // Act
55  $instance = new ASS_AnswerBinaryState();
56 
57  $this->assertInstanceOf('ASS_AnswerBinaryState', $instance);
58  }
59 
61  {
62  // Arrange
63  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
64  $instance = new ASS_AnswerBinaryState();
65  $expected = 1;
66 
67  // Act
68  $instance->setState($expected);
69  $actual = $instance->getState();
70 
71  // Assert
72  $this->assertEquals($expected, $actual);
73  }
74 
76  {
77  // Arrange
78  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
79  $instance = new ASS_AnswerBinaryState();
80  $expected = 1;
81 
82  // Act
83  $instance->setState($expected);
84  $actual = $instance->isStateChecked();
85 
86  // Assert
87  $this->assertEquals($expected, $actual);
88 
89  }
90 
92  {
93  // Arrange
94  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
95  $instance = new ASS_AnswerBinaryState();
96  $expected = 1;
97 
98  // Act
99  $instance->setState($expected);
100  $actual = $instance->isStateSet();
101 
102  // Assert
103  $this->assertEquals($expected, $actual);
104 
105  }
106 
108  {
109  // Arrange
110  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
111  $instance = new ASS_AnswerBinaryState();
112  $expected = 1;
113 
114  // Act
115  $instance->setState($expected);
116  $actual = !$instance->isStateUnset();
117 
118  // Assert
119  $this->assertEquals($expected, $actual);
120 
121  }
122 
124  {
125  // Arrange
126  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
127  $instance = new ASS_AnswerBinaryState();
128  $expected = 1;
129 
130  // Act
131  $instance->setState($expected);
132  $actual = !$instance->isStateUnchecked();
133 
134  // Assert
135  $this->assertEquals($expected, $actual);
136  }
137 
139  {
140  // Arrange
141  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
142  $instance = new ASS_AnswerBinaryState();
143  $expected = 0;
144  $instance->setState($expected);
145 
146  // Act
147  $instance->setChecked();
148  $actual = $instance->isStateUnchecked();
149 
150  // Assert
151  $this->assertEquals($expected, $actual);
152  }
153 
155  {
156  // Arrange
157  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
158  $instance = new ASS_AnswerBinaryState();
159  $expected = 1;
160  $instance->setState($expected);
161 
162  // Act
163  $instance->setUnchecked();
164  $actual = $instance->isStateUnchecked();
165 
166  // Assert
167  $this->assertEquals($expected, $actual);
168  }
169 
171  {
172  // Arrange
173  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
174  $instance = new ASS_AnswerBinaryState();
175  $expected = 0;
176  $instance->setState($expected);
177 
178  // Act
179  $instance->setSet();
180  $actual = $instance->isStateUnchecked();
181 
182  // Assert
183  $this->assertEquals($expected, $actual);
184  }
185 
187  {
188  // Arrange
189  require_once './Modules/TestQuestionPool/classes/class.assAnswerBinaryState.php';
190  $instance = new ASS_AnswerBinaryState();
191  $expected = 1;
192  $instance->setState($expected);
193 
194  // Act
195  $instance->setUnset();
196  $actual = $instance->isStateUnchecked();
197 
198  // Assert
199  $this->assertEquals($expected, $actual);
200  }
201 }