Skip to content

Commit 81177f6

Browse files
committed
Merge branch '5.2' into 5.3
* 5.2: do not mock the Request class do not mock event classes Fix use_notify default value for PostgreSqlConnection recover from failed deserializations [ErrorHandle] Remove a link from the exception page [Validator] Added Ukrainian translations [GHA] Clarify some bits in the deps=high script
2 parents e0929a2 + 3c5c5cc commit 81177f6

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

HttpCache/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private function getMetadata(string $key): array
298298
return [];
299299
}
300300

301-
return unserialize($entries);
301+
return unserialize($entries) ?: [];
302302
}
303303

304304
/**

Tests/EventListener/AddRequestFormatsListenerTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpKernel\Event\RequestEvent;
1818
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
19+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920
use Symfony\Component\HttpKernel\KernelEvents;
2021

2122
/**
@@ -54,22 +55,12 @@ public function testRegisteredEvent()
5455
public function testSetAdditionalFormats()
5556
{
5657
$request = $this->createMock(Request::class);
57-
$event = $this->getRequestEventMock($request);
58+
$event = new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST);
5859

5960
$request->expects($this->once())
6061
->method('setFormat')
6162
->with('csv', ['text/csv', 'text/plain']);
6263

6364
$this->listener->onKernelRequest($event);
6465
}
65-
66-
protected function getRequestEventMock(Request $request)
67-
{
68-
$event = $this->createMock(RequestEvent::class);
69-
$event->expects($this->any())
70-
->method('getRequest')
71-
->willReturn($request);
72-
73-
return $event;
74-
}
7566
}

Tests/EventListener/DisallowRobotsIndexingListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testInvoke(?string $expected, array $responseArgs)
2929
$response = new Response(...$responseArgs);
3030
$listener = new DisallowRobotsIndexingListener();
3131

32-
$event = new ResponseEvent($this->createMock(HttpKernelInterface::class), $this->createMock(Request::class), KernelInterface::MAIN_REQUEST, $response);
32+
$event = new ResponseEvent($this->createMock(HttpKernelInterface::class), new Request(), KernelInterface::MAIN_REQUEST, $response);
3333

3434
$listener->onResponse($event);
3535

Tests/EventListener/SessionListenerTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public function testSessionIsSet()
6161
$request = new Request();
6262
$listener = new SessionListener($container);
6363

64-
$event = $this->createMock(RequestEvent::class);
65-
$event->expects($this->exactly(2))->method('isMainRequest')->willReturn(true);
66-
$event->expects($this->once())->method('getRequest')->willReturn($request);
64+
$event = new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST);
6765

6866
$listener->onKernelRequest($event);
6967

0 commit comments

Comments
 (0)