@@ -21,6 +21,7 @@ public function testBasic()
21
21
{
22
22
$ enumSet = new EnumSet ('MabeEnumTest\TestAsset\EnumWithoutDefaultValue ' );
23
23
$ this ->assertSame ('MabeEnumTest\TestAsset\EnumWithoutDefaultValue ' , $ enumSet ->getEnumClass ());
24
+ $ this ->assertSame (EnumSet::UNIQUE , $ enumSet ->getFlags ());
24
25
25
26
$ enum1 = EnumWithoutDefaultValue::ONE ();
26
27
$ enum2 = EnumWithoutDefaultValue::TWO ();
@@ -65,6 +66,7 @@ public function testBasicWithConstantValuesAsEnums()
65
66
public function testUnique ()
66
67
{
67
68
$ enumSet = new EnumSet ('MabeEnumTest\TestAsset\EnumWithoutDefaultValue ' , EnumSet::UNIQUE );
69
+ $ this ->assertSame (EnumSet::UNIQUE , $ enumSet ->getFlags ());
68
70
69
71
$ enumSet ->attach (EnumWithoutDefaultValue::ONE ());
70
72
$ enumSet ->attach (EnumWithoutDefaultValue::ONE );
@@ -78,6 +80,7 @@ public function testUnique()
78
80
public function testNotUnique ()
79
81
{
80
82
$ enumSet = new EnumSet ('MabeEnumTest\TestAsset\EnumWithoutDefaultValue ' , 0 );
83
+ $ this ->assertSame (0 , $ enumSet ->getFlags ());
81
84
82
85
$ enumSet ->attach (EnumWithoutDefaultValue::ONE ());
83
86
$ enumSet ->attach (EnumWithoutDefaultValue::ONE );
@@ -102,6 +105,7 @@ public function testIterateUnordered()
102
105
// an empty enum set needs to be invalid, starting by 0
103
106
$ this ->assertSame (0 , $ enumSet ->count ());
104
107
$ this ->assertFalse ($ enumSet ->valid ());
108
+ $ this ->assertNull ($ enumSet ->current ());
105
109
106
110
// attach
107
111
$ enumSet ->attach ($ enum1 );
@@ -123,6 +127,7 @@ public function testIterateUnordered()
123
127
$ this ->assertNull ($ enumSet ->next ());
124
128
$ this ->assertFalse ($ enumSet ->valid ());
125
129
$ this ->assertSame (2 , $ enumSet ->key ());
130
+ $ this ->assertNull ($ enumSet ->current ());
126
131
127
132
// rewind will set the iterator position back to 0
128
133
$ enumSet ->rewind ();
@@ -141,6 +146,7 @@ public function testIterateOrdered()
141
146
// an empty enum set needs to be invalid, starting by 0
142
147
$ this ->assertSame (0 , $ enumSet ->count ());
143
148
$ this ->assertFalse ($ enumSet ->valid ());
149
+ $ this ->assertNull ($ enumSet ->current ());
144
150
145
151
// attach
146
152
$ enumSet ->attach ($ enum2 );
@@ -162,6 +168,7 @@ public function testIterateOrdered()
162
168
$ this ->assertNull ($ enumSet ->next ());
163
169
$ this ->assertFalse ($ enumSet ->valid ());
164
170
$ this ->assertSame (2 , $ enumSet ->key ());
171
+ $ this ->assertNull ($ enumSet ->current ());
165
172
166
173
// rewind will set the iterator position back to 0
167
174
$ enumSet ->rewind ();
@@ -180,6 +187,7 @@ public function testIterateOrderedNotUnique()
180
187
// an empty enum set needs to be invalid, starting by 0
181
188
$ this ->assertSame (0 , $ enumSet ->count ());
182
189
$ this ->assertFalse ($ enumSet ->valid ());
190
+ $ this ->assertNull ($ enumSet ->current ());
183
191
184
192
// attach
185
193
$ enumSet ->attach ($ enum2 );
@@ -215,6 +223,7 @@ public function testIterateOrderedNotUnique()
215
223
$ this ->assertNull ($ enumSet ->next ());
216
224
$ this ->assertFalse ($ enumSet ->valid ());
217
225
$ this ->assertSame (4 , $ enumSet ->key ());
226
+ $ this ->assertNull ($ enumSet ->current ());
218
227
219
228
// rewind will set the iterator position back to 0
220
229
$ enumSet ->rewind ();
@@ -247,6 +256,7 @@ public function testIterateAndDetach()
247
256
// detach enum of current index if the last index
248
257
$ enumSet ->detach ($ enumSet ->current ());
249
258
$ this ->assertFalse ($ enumSet ->valid ());
259
+ $ this ->assertNull ($ enumSet ->current ());
250
260
}
251
261
252
262
public function testConstructThrowsInvalidArgumentExceptionIfEnumClassDoesNotExtendBaseEnum ()
0 commit comments