Skip to content

Commit 2cf5163

Browse files
committed
fix tests mocking final events
1 parent e95ba10 commit 2cf5163

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Tests/EventListener/AddLinkHeaderListenerTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpKernel\Event\ResponseEvent;
19+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920
use Symfony\Component\HttpKernel\KernelEvents;
2021
use Symfony\Component\WebLink\EventListener\AddLinkHeaderListener;
2122
use Symfony\Component\WebLink\GenericLinkProvider;
@@ -33,10 +34,7 @@ public function testOnKernelResponse()
3334

3435
$subscriber = new AddLinkHeaderListener();
3536

36-
$event = $this->getMockBuilder(ResponseEvent::class)->disableOriginalConstructor()->getMock();
37-
$event->method('isMasterRequest')->willReturn(true);
38-
$event->method('getRequest')->willReturn($request);
39-
$event->method('getResponse')->willReturn($response);
37+
$event = new ResponseEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST, $response);
4038

4139
$subscriber->onKernelResponse($event);
4240

0 commit comments

Comments
 (0)