ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
assAnswerBinaryStateTest.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  protected $backupGlobals = false;
29 
30  protected function setUp(): void
31  {
32  chdir(__DIR__ . '/../../../../');
33  }
34 
36  {
37  $instance = new ASS_AnswerBinaryState();
38 
39  $this->assertInstanceOf(ASS_AnswerBinaryState::class, $instance);
40  }
41 
43  {
44  $instance = new ASS_AnswerBinaryState();
45  $expected = 1;
46 
47  $instance->setState($expected);
48  $actual = $instance->getState();
49 
50  $this->assertEquals($expected, $actual);
51  }
52 
54  {
55  $instance = new ASS_AnswerBinaryState();
56  $expected = 1;
57 
58  $instance->setState($expected);
59  $actual = $instance->isStateChecked();
60 
61  $this->assertEquals($expected, $actual);
62  }
63 
65  {
66  $instance = new ASS_AnswerBinaryState();
67  $expected = 1;
68 
69  $instance->setState($expected);
70  $actual = $instance->isStateSet();
71 
72  $this->assertEquals($expected, $actual);
73  }
74 
76  {
77  $instance = new ASS_AnswerBinaryState();
78  $expected = 1;
79 
80  $instance->setState($expected);
81  $actual = !$instance->isStateUnset();
82 
83  $this->assertEquals($expected, $actual);
84  }
85 
87  {
88  $instance = new ASS_AnswerBinaryState();
89  $expected = 1;
90 
91  $instance->setState($expected);
92  $actual = !$instance->isStateUnchecked();
93 
94  $this->assertEquals($expected, $actual);
95  }
96 
97  public function test_setChecked_shouldAlterState(): void
98  {
99  $instance = new ASS_AnswerBinaryState();
100  $expected = 0;
101  $instance->setState($expected);
102 
103  $instance->setChecked();
104  $actual = $instance->isStateUnchecked();
105 
106  $this->assertEquals($expected, $actual);
107  }
108 
109  public function test_setUnchecked_shouldAlterState(): void
110  {
111  $instance = new ASS_AnswerBinaryState();
112  $expected = 1;
113  $instance->setState($expected);
114 
115  $instance->setUnchecked();
116  $actual = $instance->isStateUnchecked();
117 
118  $this->assertEquals($expected, $actual);
119  }
120 
121  public function test_setSet_shouldAlterState(): void
122  {
123  $instance = new ASS_AnswerBinaryState();
124  $expected = 0;
125  $instance->setState($expected);
126 
127  $instance->setSet();
128  $actual = $instance->isStateUnchecked();
129 
130  $this->assertEquals($expected, $actual);
131  }
132 
133  public function test_setUnset_shouldAlterState(): void
134  {
135  $instance = new ASS_AnswerBinaryState();
136  $expected = 1;
137  $instance->setState($expected);
138 
139  $instance->setUnset();
140  $actual = $instance->isStateUnchecked();
141 
142  $this->assertEquals($expected, $actual);
143  }
144 }
Class assBaseTestCase.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...