ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assAnswerBinaryStateTest Class Reference

Unit tests. More...

+ Inheritance diagram for assAnswerBinaryStateTest:
+ Collaboration diagram for assAnswerBinaryStateTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_setGetState_shouldReturnUnchangedState ()
 
 test_isStateChecked_shouldReturnActualState ()
 
 test_isStateSet_shouldReturnActualState ()
 
 test_isStateUnset_shouldReturnActualState ()
 
 test_isStateUnchecked_shouldReturnActualState ()
 
 test_setChecked_shouldAlterState ()
 
 test_setUnchecked_shouldAlterState ()
 
 test_setSet_shouldAlterState ()
 
 test_setUnset_shouldAlterState ()
 

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 assAnswerBinaryStateTest.php.

Member Function Documentation

◆ setUp()

assAnswerBinaryStateTest::setUp ( )
protected

Definition at line 15 of file assAnswerBinaryStateTest.php.

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  }

◆ test_instantiateObject_shouldReturnInstance()

assAnswerBinaryStateTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 26 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_isStateChecked_shouldReturnActualState()

assAnswerBinaryStateTest::test_isStateChecked_shouldReturnActualState ( )

Definition at line 52 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_isStateSet_shouldReturnActualState()

assAnswerBinaryStateTest::test_isStateSet_shouldReturnActualState ( )

Definition at line 67 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_isStateUnchecked_shouldReturnActualState()

assAnswerBinaryStateTest::test_isStateUnchecked_shouldReturnActualState ( )

Definition at line 97 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_isStateUnset_shouldReturnActualState()

assAnswerBinaryStateTest::test_isStateUnset_shouldReturnActualState ( )

Definition at line 82 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_setChecked_shouldAlterState()

assAnswerBinaryStateTest::test_setChecked_shouldAlterState ( )

Definition at line 112 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_setGetState_shouldReturnUnchangedState()

assAnswerBinaryStateTest::test_setGetState_shouldReturnUnchangedState ( )

Definition at line 37 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_setSet_shouldAlterState()

assAnswerBinaryStateTest::test_setSet_shouldAlterState ( )

Definition at line 144 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_setUnchecked_shouldAlterState()

assAnswerBinaryStateTest::test_setUnchecked_shouldAlterState ( )

Definition at line 128 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

◆ test_setUnset_shouldAlterState()

assAnswerBinaryStateTest::test_setUnset_shouldAlterState ( )

Definition at line 160 of file assAnswerBinaryStateTest.php.

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  }
Class for true/false or yes/no answers.

Field Documentation

◆ $backupGlobals

assAnswerBinaryStateTest::$backupGlobals = false
protected

Definition at line 13 of file assAnswerBinaryStateTest.php.


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