From 1d812dc3a2863cc4246aaa636b0d71e0bf68e6b0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Apr 2024 13:17:46 +0200 Subject: [PATCH 1/3] Update VERSION for 5.4.39 --- Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel.php b/Kernel.php index aae7d8f9cd..d4fe96b6b7 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.39-DEV'; + public const VERSION = '5.4.39'; public const VERSION_ID = 50439; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; public const RELEASE_VERSION = 39; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From 96e9edea57f8c5f09b1f0c7ea01d4e6996ac1625 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 29 Apr 2024 13:21:23 +0200 Subject: [PATCH 2/3] Bump Symfony version to 5.4.40 --- Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel.php b/Kernel.php index d4fe96b6b7..c51f96e861 100644 --- a/Kernel.php +++ b/Kernel.php @@ -78,12 +78,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ private static $freshCache = []; - public const VERSION = '5.4.39'; - public const VERSION_ID = 50439; + public const VERSION = '5.4.40-DEV'; + public const VERSION_ID = 50440; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 4; - public const RELEASE_VERSION = 39; - public const EXTRA_VERSION = ''; + public const RELEASE_VERSION = 40; + public const EXTRA_VERSION = 'DEV'; public const END_OF_MAINTENANCE = '11/2024'; public const END_OF_LIFE = '11/2025'; From aa6a398b71e192394671c17636217b2faf87b001 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 26 Apr 2024 13:35:27 +0200 Subject: [PATCH 3/3] Remove calls to `onConsecutiveCalls()` --- Tests/EventListener/SessionListenerTest.php | 20 +++++++++---------- Tests/Fragment/InlineFragmentRendererTest.php | 15 ++++++++++---- Tests/HttpCache/EsiTest.php | 2 +- Tests/HttpCache/SsiTest.php | 2 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Tests/EventListener/SessionListenerTest.php b/Tests/EventListener/SessionListenerTest.php index f3265823a5..1934af6624 100644 --- a/Tests/EventListener/SessionListenerTest.php +++ b/Tests/EventListener/SessionListenerTest.php @@ -45,7 +45,7 @@ class SessionListenerTest extends TestCase public function testSessionCookieOptions(array $phpSessionOptions, array $sessionOptions, array $expectedSessionOptions) { $session = $this->createMock(Session::class); - $session->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->method('getUsageIndex')->willReturn(0, 1); $session->method('getId')->willReturn('123456'); $session->method('getName')->willReturn('PHPSESSID'); $session->method('save'); @@ -398,7 +398,7 @@ public function testSessionUsesFactory() public function testResponseIsPrivateIfSessionStarted() { $session = $this->createMock(Session::class); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $container = new Container(); $container->set('initialized_session', $session); @@ -423,7 +423,7 @@ public function testResponseIsPrivateIfSessionStarted() public function testResponseIsStillPublicIfSessionStartedAndHeaderPresent() { $session = $this->createMock(Session::class); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $container = new Container(); $container->set('initialized_session', $session); @@ -450,7 +450,7 @@ public function testResponseIsStillPublicIfSessionStartedAndHeaderPresent() public function testSessionSaveAndResponseHasSessionCookie() { $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $session->expects($this->exactly(1))->method('getId')->willReturn('123456'); $session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID'); $session->expects($this->exactly(1))->method('save'); @@ -535,7 +535,7 @@ public function testUninitializedSessionWithoutInitializedSession() public function testResponseHeadersMaxAgeAndExpiresNotBeOverridenIfSessionStarted() { $session = $this->createMock(Session::class); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $container = new Container(); $container->set('initialized_session', $session); @@ -565,7 +565,7 @@ public function testResponseHeadersMaxAgeAndExpiresNotBeOverridenIfSessionStarte public function testResponseHeadersMaxAgeAndExpiresDefaultValuesIfSessionStarted() { $session = $this->createMock(Session::class); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $container = new Container(); $container->set('initialized_session', $session); @@ -618,7 +618,7 @@ public function testSurrogateMainRequestIsPublic() { $session = $this->createMock(Session::class); $session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID'); - $session->expects($this->exactly(4))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1, 1, 1)); + $session->expects($this->exactly(4))->method('getUsageIndex')->willReturn(0, 1, 1, 1); $container = new Container(); $container->set('initialized_session', $session); @@ -715,7 +715,7 @@ public function testGetSessionSetsSessionOnMainRequest() public function testSessionUsageExceptionIfStatelessAndSessionUsed() { $session = $this->createMock(Session::class); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $container = new Container(); $container->set('initialized_session', $session); @@ -734,7 +734,7 @@ public function testSessionUsageExceptionIfStatelessAndSessionUsed() public function testSessionUsageLogIfStatelessAndSessionUsed() { $session = $this->createMock(Session::class); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $logger = $this->createMock(LoggerInterface::class); $logger->expects($this->exactly(1))->method('warning'); @@ -759,7 +759,7 @@ public function testSessionIsSavedWhenUnexpectedSessionExceptionThrown() $session->expects($this->exactly(1))->method('getId')->willReturn('123456'); $session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID'); $session->method('isStarted')->willReturn(true); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $session->expects($this->exactly(1))->method('save'); $container = new Container(); diff --git a/Tests/Fragment/InlineFragmentRendererTest.php b/Tests/Fragment/InlineFragmentRendererTest.php index 69bd7445ac..fb22a1a094 100644 --- a/Tests/Fragment/InlineFragmentRendererTest.php +++ b/Tests/Fragment/InlineFragmentRendererTest.php @@ -102,10 +102,17 @@ public function testRenderExceptionIgnoreErrors() public function testRenderExceptionIgnoreErrorsWithAlt() { - $strategy = new InlineFragmentRenderer($this->getKernel($this->onConsecutiveCalls( - $this->throwException(new \RuntimeException('foo')), - $this->returnValue(new Response('bar')) - ))); + $strategy = new InlineFragmentRenderer($this->getKernel($this->returnCallback(function () { + static $firstCall = true; + + if ($firstCall) { + $firstCall = false; + + throw new \RuntimeException('foo'); + } + + return new Response('bar'); + }))); $this->assertEquals('bar', $strategy->render('/', Request::create('/'), ['ignore_errors' => true, 'alt' => '/foo'])->getContent()); } diff --git a/Tests/HttpCache/EsiTest.php b/Tests/HttpCache/EsiTest.php index e876f28189..677d38be62 100644 --- a/Tests/HttpCache/EsiTest.php +++ b/Tests/HttpCache/EsiTest.php @@ -245,7 +245,7 @@ protected function getCache($request, $response) if (\is_array($response)) { $cache->expects($this->any()) ->method('handle') - ->will($this->onConsecutiveCalls(...$response)) + ->willReturn(...$response) ; } else { $cache->expects($this->any()) diff --git a/Tests/HttpCache/SsiTest.php b/Tests/HttpCache/SsiTest.php index 97cc8fccd0..15e6ebcaee 100644 --- a/Tests/HttpCache/SsiTest.php +++ b/Tests/HttpCache/SsiTest.php @@ -201,7 +201,7 @@ protected function getCache($request, $response) if (\is_array($response)) { $cache->expects($this->any()) ->method('handle') - ->will($this->onConsecutiveCalls(...$response)) + ->willReturn(...$response) ; } else { $cache->expects($this->any())