@@ -28,6 +28,28 @@ private function createCors(array $config = []): Cors
2828 return new Cors ($ config );
2929 }
3030
31+ private function createRequest (): IncomingRequest
32+ {
33+ return Services ::incomingrequest (null , false );
34+ }
35+
36+ private function getDefaultConfig (): array
37+ {
38+ return [
39+ 'allowedOrigins ' => [],
40+ 'allowedOriginsPatterns ' => [],
41+ 'supportsCredentials ' => false ,
42+ 'allowedHeaders ' => ['X-API-KEY ' , 'X-Requested-With ' , 'Content-Type ' , 'Accept ' ],
43+ 'allowedMethods ' => ['PUT ' ],
44+ 'maxAge ' => 3600 ,
45+ ];
46+ }
47+
48+ private function assertHeader (ResponseInterface $ response , string $ name , string $ value ): void
49+ {
50+ $ this ->assertSame ($ value , $ response ->getHeaderLine ($ name ));
51+ }
52+
3153 public function testInstantiate ()
3254 {
3355 $ cors = $ this ->createCors ();
@@ -56,23 +78,6 @@ public function testIsPreflightRequestFalse()
5678 $ this ->assertFalse ($ cors ->isPreflightRequest ($ request ));
5779 }
5880
59- private function createRequest (): IncomingRequest
60- {
61- return Services ::incomingrequest (null , false );
62- }
63-
64- private function getDefaultConfig (): array
65- {
66- return [
67- 'allowedOrigins ' => [],
68- 'allowedOriginsPatterns ' => [],
69- 'supportsCredentials ' => false ,
70- 'allowedHeaders ' => ['X-API-KEY ' , 'X-Requested-With ' , 'Content-Type ' , 'Accept ' ],
71- 'allowedMethods ' => ['PUT ' ],
72- 'maxAge ' => 3600 ,
73- ];
74- }
75-
7681 public function testHandlePreflightRequestSingleAllowedOrigin ()
7782 {
7883 $ config = $ this ->getDefaultConfig ();
@@ -108,11 +113,6 @@ public function testHandlePreflightRequestSingleAllowedOrigin()
108113 );
109114 }
110115
111- private function assertHeader (ResponseInterface $ response , string $ name , string $ value ): void
112- {
113- $ this ->assertSame ($ value , $ response ->getHeaderLine ($ name ));
114- }
115-
116116 public function testHandlePreflightRequestMultipleAllowedOriginsAllowed ()
117117 {
118118 $ config = $ this ->getDefaultConfig ();
0 commit comments