method('isPost')->willReturn(true); $expectedResponse = ResponseFactory::create()->createResponse(); $authPlugin = self::createMock(AuthenticationPlugin::class); $authPlugin->expects(self::once())->method('logOut')->willReturn($expectedResponse); $factory = self::createStub(AuthenticationPluginFactory::class); $factory->method('create')->willReturn($authPlugin); $response = (new LogoutController($factory, new ResponseRenderer()))($request); self::assertSame($expectedResponse, $response); } }