You are here

public function RouteNameResponseSubscriberTest::testOnResponseUncacheable in Page Manager 8

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/RouteNameResponseSubscriberTest.php \Drupal\Tests\page_manager\Unit\RouteNameResponseSubscriberTest::testOnResponseUncacheable()

@covers ::onResponse

File

tests/src/Unit/RouteNameResponseSubscriberTest.php, line 50
Contains \Drupal\Tests\page_manager\Unit\RouteNameResponseSubscriberTest.

Class

RouteNameResponseSubscriberTest
@coversDefaultClass \Drupal\page_manager\EventSubscriber\RouteNameResponseSubscriber @group PageManager

Namespace

Drupal\Tests\page_manager\Unit

Code

public function testOnResponseUncacheable() {
  $response = new Response('');
  $event = $this
    ->buildEvent($response);
  $master_route_match = $this
    ->prophesize(RouteMatchInterface::class);
  $master_route_match
    ->getParameter()
    ->shouldNotBeCalled();
  $master_route_match
    ->getRouteName()
    ->shouldNotBeCalled();
  $current_route_match = $this
    ->prophesize(StackedRouteMatchInterface::class);
  $current_route_match
    ->getMasterRouteMatch()
    ->willReturn($master_route_match
    ->reveal());
  $subscriber = new RouteNameResponseSubscriber($current_route_match
    ->reveal());
  $subscriber
    ->onResponse($event);
}