@@ -27,8 +27,9 @@ class WhitelistTest extends TestCase
2727 */
2828 public function test_it_can_be_created_from_a_list_of_strings (
2929 array $ whitelist ,
30+ array $ expectedNamespaces ,
3031 array $ expectedClasses ,
31- array $ expectedNamespaces
32+ array $ expectedConstants
3233 ) {
3334 $ whitelistObject = Whitelist::create (true , ...$ whitelist );
3435
@@ -40,15 +41,21 @@ public function test_it_can_be_created_from_a_list_of_strings(
4041 $ whitelistNamespaceReflection ->setAccessible (true );
4142 $ actualNamespaces = $ whitelistNamespaceReflection ->getValue ($ whitelistObject );
4243
44+ $ whitelistConstantReflection = $ whitelistReflection ->getProperty ('constants ' );
45+ $ whitelistConstantReflection ->setAccessible (true );
46+ $ actualConstants = $ whitelistConstantReflection ->getValue ($ whitelistObject );
47+
4348 $ this ->assertTrue ($ whitelistObject ->whitelistGlobalConstants ());
44- $ this ->assertSame ($ expectedClasses , $ actualClasses );
4549 $ this ->assertSame ($ expectedNamespaces , $ actualNamespaces );
50+ $ this ->assertSame ($ expectedClasses , $ actualClasses );
51+ $ this ->assertSame ($ expectedConstants , $ actualConstants );
4652
4753 $ whitelistObject = Whitelist::create (false , ...$ whitelist );
4854
4955 $ this ->assertFalse ($ whitelistObject ->whitelistGlobalConstants ());
5056 $ this ->assertSame ($ expectedClasses , $ actualClasses );
5157 $ this ->assertSame ($ expectedNamespaces , $ actualNamespaces );
58+ $ this ->assertSame ($ expectedConstants , $ actualConstants );
5259 }
5360
5461 /**
@@ -83,19 +90,22 @@ public function test_it_can_be_converted_back_into_an_array(Whitelist $whitelist
8390
8491 public function provideWhitelists ()
8592 {
86- yield [[], [], []];
87-
88- yield [['Acme\Foo ' ], ['Acme\Foo ' ], []];
93+ yield [[], [], [], []];
8994
90- yield [['\ Acme\Foo ' ], ['Acme\Foo ' ], []];
95+ yield [['Acme\Foo ' ], [], [ 'Acme\Foo ' ], [' acme\Foo ' ]];
9196
92- yield [['Acme\Foo\* ' ], [], [' Acme\Foo ' ]];
97+ yield [['Acme\Foo\* ' ], [' acme\foo ' ], [], [ ]];
9398
94- yield [['\* ' ], [], ['' ]];
99+ yield [['\* ' ], ['' ], [], [ ]];
95100
96- yield [['* ' ], [], ['' ]];
101+ yield [['* ' ], ['' ], [], [ ]];
97102
98- yield [['Acme\Foo ' , 'Acme\Foo\* ' , '\* ' ], ['Acme\Foo ' ], ['Acme\Foo ' , '' ]];
103+ yield [
104+ ['Acme\Foo ' , 'Acme\Foo\* ' , '\* ' ],
105+ ['acme\foo ' , '' ],
106+ ['Acme\Foo ' ],
107+ ['acme\Foo ' ],
108+ ];
99109 }
100110
101111 public function provideClassWhitelists ()
@@ -151,29 +161,59 @@ public function provideNamespaceWhitelists()
151161 true ,
152162 ];
153163
164+ yield [
165+ Whitelist::create (true , 'Acme\Foo\* ' ),
166+ 'acme\foo ' ,
167+ true ,
168+ ];
169+
154170 yield [
155171 Whitelist::create (true , 'Acme\* ' ),
156172 'Acme\Foo ' ,
157173 true ,
158174 ];
159175
176+ yield [
177+ Whitelist::create (true , 'Acme\* ' ),
178+ 'acme\foo ' ,
179+ true ,
180+ ];
181+
160182 yield [
161183 Whitelist::create (true , 'Acme\Foo\* ' ),
162184 'Acme\Foo\Bar ' ,
163185 true ,
164186 ];
165187
188+ yield [
189+ Whitelist::create (true , 'Acme\Foo\* ' ),
190+ 'acme\foo\bar ' ,
191+ true ,
192+ ];
193+
166194 yield [
167195 Whitelist::create (true , '\* ' ),
168196 'Acme ' ,
169197 true ,
170198 ];
171199
200+ yield [
201+ Whitelist::create (true , '\* ' ),
202+ 'acme ' ,
203+ true ,
204+ ];
205+
172206 yield [
173207 Whitelist::create (true , '\* ' ),
174208 'Acme\Foo ' ,
175209 true ,
176210 ];
211+
212+ yield [
213+ Whitelist::create (true , '\* ' ),
214+ 'acme\foo ' ,
215+ true ,
216+ ];
177217 }
178218
179219 public function provideWhitelistToConvert ()
0 commit comments