@@ -44,36 +44,36 @@ public function testCreateRequest()
44
44
{
45
45
$ stdClass = new \stdClass ();
46
46
$ request =
D7AE
new Request (
47
- array (
47
+ [
48
48
'foo ' => '1 ' ,
49
- 'bar ' => array ( 'baz ' => '42 ' ) ,
50
- ) ,
51
- array (
52
- 'twitter ' => array (
49
+ 'bar ' => [ 'baz ' => '42 ' ] ,
50
+ ] ,
51
+ [
52
+ 'twitter ' => [
53
53
'@dunglas ' => 'Kévin Dunglas ' ,
54
54
'@coopTilleuls ' => 'Les-Tilleuls.coop ' ,
55
- ) ,
55
+ ] ,
56
56
'baz ' => '2 ' ,
57
- ) ,
58
- array (
57
+ ] ,
58
+ [
59
59
'a1 ' => $ stdClass ,
60
- 'a2 ' => array ( 'foo ' => 'bar ' ) ,
61
- ) ,
62
- array (
60
+ 'a2 ' => [ 'foo ' => 'bar ' ] ,
61
+ ] ,
62
+ [
63
63
'c1 ' => 'foo ' ,
64
- 'c2 ' => array ( 'c3 ' => 'bar ' ) ,
65
- ) ,
66
- array (
64
+ 'c2 ' => [ 'c3 ' => 'bar ' ] ,
65
+ ] ,
66
+ [
67
67
'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
+ [
71
71
'REQUEST_METHOD ' => 'POST ' ,
72
72
'HTTP_HOST ' => 'dunglas.fr ' ,
73
73
'HTTP_X_SYMFONY ' => '2.8 ' ,
74
74
'REQUEST_URI ' => '/testCreateRequest?foo=1&bar[baz]=42 ' ,
75
75
'QUERY_STRING ' => 'foo=1&bar[baz]=42 ' ,
76
- ) ,
76
+ ] ,
77
77
'Content '
78
78
);
79
79
@@ -116,13 +116,13 @@ public function testCreateRequest()
116
116
$ this ->assertEquals ('POST ' , $ serverParams ['REQUEST_METHOD ' ]);
117
117
$ this ->assertEquals ('2.8 ' , $ serverParams ['HTTP_X_SYMFONY ' ]);
118
118
$ this ->assertEquals ('POST ' , $ psrRequest ->getMethod ());
119
- $ this ->assertEquals (array ( '2.8 ' ) , $ psrRequest ->getHeader ('X-Symfony ' ));
119
+ $ this ->assertEquals ([ '2.8 ' ] , $ psrRequest ->getHeader ('X-Symfony ' ));
120
120
}
121
121
122
122
public function testGetContentCanBeCalledAfterRequestCreation ()
123
123
{
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 ' );
126
126
127
127
$ psrRequest = $ this ->factory ->createRequest ($ request );
128
128
@@ -139,6 +139,7 @@ private function createUploadedFile($content, $originalName, $mimeType, $error)
139
139
// Symfony 4.1+
140
140
return new UploadedFile ($ path , $ originalName , $ mimeType , $ error , true );
141
141
}
142
+
142
143
return new UploadedFile ($ path , $ originalName , $ mimeType , filesize ($ path ), $ error , true );
143
144
}
144
145
@@ -147,14 +148,14 @@ public function testCreateResponse()
147
148
$ response = new Response (
148
149
'Response content. ' ,
149
150
202 ,
150
- array ( 'X-Symfony ' => array ( '3.4 ' ))
151
+ [ 'X-Symfony ' => [ '3.4 ' ]]
151
152
);
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 ));
153
154
154
155
$ psrResponse = $ this ->factory ->createResponse ($ response );
155
156
$ this ->assertEquals ('Response content. ' , $ psrResponse ->getBody ()->__toString ());
156
157
$ this ->assertEquals (202 , $ psrResponse ->getStatusCode ());
157
- $ this ->assertEquals (array ( '3.4 ' ) , $ psrResponse ->getHeader ('X-Symfony ' ));
158
+ $ this ->assertEquals ([ '3.4 ' ] , $ psrResponse ->getHeader ('X-Symfony ' ));
158
159
159
160
$ cookieHeader = $ psrResponse ->getHeader ('Set-Cookie ' );
160
161
$ this ->assertInternalType ('array ' , $ cookieHeader );
@@ -201,17 +202,21 @@ public function testUploadErrNoFile()
201
202
$ this ->assertEquals (UPLOAD_ERR_NO_FILE , $ file ->getError ());
202
203
$ this ->assertFalse ($ file ->getSize (), 'SplFile::getSize() returns false on error ' );
203
204
204
- $ request = new Request (array (), array (), array (), array (),
205
- array (
205
+ $ request = new Request (
206
+ [],
207
+ [],
208
+ [],
209
+ [],
210
+ [
206
211
'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
+ [
210
215
'REQUEST_METHOD ' => 'POST ' ,
211
216
'HTTP_HOST ' => 'dunglas.fr ' ,
212
217
'HTTP_X_SYMFONY ' => '2.8 ' ,
213
- ) ,
214
- 'Content '
218
+ ] ,
219
+ 'Content '
215
220
);
216
221
217
222
$ psrRequest = $ this ->factory ->createRequest ($ request );
0 commit comments