diff --git a/Tests/EventListener/SessionListenerTest.php b/Tests/EventListener/SessionListenerTest.php index afad291636..a8d68e85f8 100644 --- a/Tests/EventListener/SessionListenerTest.php +++ b/Tests/EventListener/SessionListenerTest.php @@ -44,7 +44,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'); @@ -493,7 +493,7 @@ public function testResponseIsStillPublicIfSessionStartedAndHeaderPresent() public function testSessionSaveAndResponseHasSessionCookie() { $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); - $session->expects($this->exactly(1))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(1))->method('getUsageIndex')->willReturn(0); $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'); @@ -646,7 +646,7 @@ public function testSurrogateMainRequestIsPublic() { $session = $this->createMock(Session::class); $session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID'); - $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); + $session->expects($this->exactly(2))->method('getUsageIndex')->willReturn(0, 1); $sessionFactory = $this->createMock(SessionFactory::class); $sessionFactory->expects($this->once())->method('createSession')->willReturn($session); diff --git a/Tests/Fragment/InlineFragmentRendererTest.php b/Tests/Fragment/InlineFragmentRendererTest.php index c5cec4ba7a..2d079b1db0 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())