File tree 1 file changed +14
-2
lines changed
src/Symfony/Component/HttpKernel/Tests/Fragment
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \HttpKernel \Tests \Fragment ;
13
13
14
+ use PHPUnit \Framework \Constraint \IsEqual ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
use Symfony \Component \EventDispatcher \EventDispatcher ;
16
17
use Symfony \Component \HttpFoundation \Request ;
@@ -261,13 +262,24 @@ public function testIpAddressOfRangedTrustedProxyIsSetAsRemote()
261
262
/**
262
263
* Creates a Kernel expecting a request equals to $request.
263
264
*/
264
- private function getKernelExpectingRequest (Request $ request , $ strict = false )
265
+ private function getKernelExpectingRequest (Request $ expectedRequest )
265
266
{
266
267
$ kernel = $ this ->createMock (HttpKernelInterface::class);
267
268
$ kernel
268
269
->expects ($ this ->once ())
269
270
->method ('handle ' )
270
- ->with ($ request )
271
+ ->with ($ this ->callback (function (Request $ request ) use ($ expectedRequest ) {
272
+ $ requestClone = clone $ request ;
273
+ $ expectedRequestClone = clone $ expectedRequest ;
274
+
275
+ $ irrelevantServerKeys = ['REQUEST_TIME ' , 'REQUEST_TIME_FLOAT ' ];
276
+ foreach ($ irrelevantServerKeys as $ irrelevantServerKey ) {
277
+ $ requestClone ->server ->remove ($ irrelevantServerKey );
278
+ $ expectedRequestClone ->server ->remove ($ irrelevantServerKey );
279
+ }
280
+
281
+ return (new IsEqual ($ expectedRequestClone ))->evaluate ($ requestClone );
282
+ }))
271
283
->willReturn (new Response ('foo ' ));
272
284
273
285
return $ kernel ;
You can’t perform that action at this time.
0 commit comments