@@ -44,36 +44,36 @@ public function testCreateRequest()
4444 {
4545 $ stdClass = new \stdClass ();
4646 $ request = new Request (
47- array (
47+ [
4848 'foo ' => '1 ' ,
49- 'bar ' => array ( 'baz ' => '42 ' ) ,
50- ) ,
51- array (
52- 'twitter ' => array (
49+ 'bar ' => [ 'baz ' => '42 ' ] ,
50+ ] ,
51+ [
52+ 'twitter ' => [
5353 '@dunglas ' => 'Kévin Dunglas ' ,
5454 '@coopTilleuls ' => 'Les-Tilleuls.coop ' ,
55- ) ,
55+ ] ,
5656 'baz ' => '2 ' ,
57- ) ,
58- array (
57+ ] ,
58+ [
5959 'a1 ' => $ stdClass ,
60- 'a2 ' => array ( 'foo ' => 'bar ' ) ,
61- ) ,
62- array (
60+ 'a2 ' => [ 'foo ' => 'bar ' ] ,
61+ ] ,
62+ [
6363 'c1 ' => 'foo ' ,
64- 'c2 ' => array ( 'c3 ' => 'bar ' ) ,
65- ) ,
66- array (
64+ 'c2 ' => [ 'c3 ' => 'bar ' ] ,
65+ ] ,
66+ [
6767 'f1 ' => $ this ->createUploadedFile ('F1 ' , 'f1.txt ' , 'text/plain ' , UPLOAD_ERR_OK ),
68- 'foo ' => array ( 'f2 ' => $ this ->createUploadedFile ('F2 ' , 'f2.txt ' , 'text/plain ' , UPLOAD_ERR_OK )) ,
69- ) ,
70- array (
68+ 'foo ' => [ 'f2 ' => $ this ->createUploadedFile ('F2 ' , 'f2.txt ' , 'text/plain ' , UPLOAD_ERR_OK )] ,
69+ ] ,
70+ [
7171 'REQUEST_METHOD ' => 'POST ' ,
7272 'HTTP_HOST ' => 'dunglas.fr ' ,
7373 'HTTP_X_SYMFONY ' => '2.8 ' ,
7474 'REQUEST_URI ' => '/testCreateRequest?foo=1&bar[baz]=42 ' ,
7575 'QUERY_STRING ' => 'foo=1&bar[baz]=42 ' ,
76- ) ,
76+ ] ,
7777 'Content '
7878 );
7979
@@ -116,13 +116,13 @@ public function testCreateRequest()
116116 $ this ->assertEquals ('POST ' , $ serverParams ['REQUEST_METHOD ' ]);
117117 $ this ->assertEquals ('2.8 ' , $ serverParams ['HTTP_X_SYMFONY ' ]);
118118 $ this ->assertEquals ('POST ' , $ psrRequest ->getMethod ());
119- $ this ->assertEquals (array ( '2.8 ' ) , $ psrRequest ->getHeader ('X-Symfony ' ));
119+ $ this ->assertEquals ([ '2.8 ' ] , $ psrRequest ->getHeader ('X-Symfony ' ));
120120 }
121121
122122 public function testGetContentCanBeCalledAfterRequestCreation ()
123123 {
124- $ header = array ( 'HTTP_HOST ' => 'dunglas.fr ' ) ;
125- $ request = new Request (array (), array (), array (), array (), array () , $ header , 'Content ' );
124+ $ header = [ 'HTTP_HOST ' => 'dunglas.fr ' ] ;
125+ $ request = new Request ([], [], [], [], [] , $ header , 'Content ' );
126126
127127 $ psrRequest = $ this ->factory ->createRequest ($ request );
128128
@@ -139,6 +139,7 @@ private function createUploadedFile($content, $originalName, $mimeType, $error)
139139 // Symfony 4.1+
140140 return new UploadedFile ($ path , $ originalName , $ mimeType , $ error , true );
141141 }
142+
142143 return new UploadedFile ($ path , $ originalName , $ mimeType , filesize ($ path ), $ error , true );
143144 }
144145
@@ -147,14 +148,14 @@ public function testCreateResponse()
147148 $ response = new Response (
148149 'Response content. ' ,
149150 202 ,
150- array ( 'X-Symfony ' => array ( '3.4 ' ))
151+ [ 'X-Symfony ' => [ '3.4 ' ]]
151152 );
152- $ response ->headers ->setCookie (new Cookie ('city ' , 'Lille ' , new \DateTime ('Wed, 13 Jan 2021 22:23:01 GMT ' ), '/ ' , null , false , true , false , '' ));
153+ $ response ->headers ->setCookie (new Cookie ('city ' , 'Lille ' , new \DateTime ('Wed, 13 Jan 2021 22:23:01 GMT ' ), '/ ' , null , false , true , false , null ));
153154
154155 $ psrResponse = $ this ->factory ->createResponse ($ response );
155156 $ this ->assertEquals ('Response content. ' , $ psrResponse ->getBody ()->__toString ());
156157 $ this ->assertEquals (202 , $ psrResponse ->getStatusCode ());
157- $ this ->assertEquals (array ( '3.4 ' ) , $ psrResponse ->getHeader ('X-Symfony ' ));
158+ $ this ->assertEquals ([ '3.4 ' ] , $ psrResponse ->getHeader ('X-Symfony ' ));
158159
159160 $ cookieHeader = $ psrResponse ->getHeader ('Set-Cookie ' );
160161 $ this ->assertInternalType ('array ' , $ cookieHeader );
@@ -201,17 +202,21 @@ public function testUploadErrNoFile()
201202 $ this ->assertEquals (UPLOAD_ERR_NO_FILE , $ file ->getError ());
202203 $ this ->assertFalse ($ file ->getSize (), 'SplFile::getSize() returns false on error ' );
203204
204- $ request = new Request (array (), array (), array (), array (),
205- array (
205+ $ request = new Request (
206+ [],
207+ [],
208+ [],
209+ [],
210+ [
206211 'f1 ' => $ file ,
207- 'f2 ' => array ( 'name ' => null , 'type ' => null , 'tmp_name ' => null , 'error ' => UPLOAD_ERR_NO_FILE , 'size ' => 0 ) ,
208- ) ,
209- array (
212+ 'f2 ' => [ 'name ' => null , 'type ' => null , 'tmp_name ' => null , 'error ' => UPLOAD_ERR_NO_FILE , 'size ' => 0 ] ,
213+ ] ,
214+ [
210215 'REQUEST_METHOD ' => 'POST ' ,
211216 'HTTP_HOST ' => 'dunglas.fr ' ,
212217 'HTTP_X_SYMFONY ' => '2.8 ' ,
213- ) ,
214- 'Content '
218+ ] ,
219+ 'Content '
215220 );
216221
217222 $ psrRequest = $ this ->factory ->createRequest ($ request );
0 commit comments