You are here

public function RoutePreloaderTest::testOnRequestNonHtml in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnRequestNonHtml()

Tests onRequest on a non html request.

File

core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php, line 132
Contains \Drupal\Tests\Core\Routing\RoutePreloaderTest.

Class

RoutePreloaderTest
@coversDefaultClass \Drupal\Core\Routing\RoutePreloader @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testOnRequestNonHtml() {
  $event = $this
    ->getMockBuilder('\\Symfony\\Component\\HttpKernel\\Event\\KernelEvent')
    ->disableOriginalConstructor()
    ->getMock();
  $request = new Request();
  $request
    ->setRequestFormat('non-html');
  $event
    ->expects($this
    ->any())
    ->method('getRequest')
    ->will($this
    ->returnValue($request));
  $this->routeProvider
    ->expects($this
    ->never())
    ->method('getRoutesByNames');
  $this->state
    ->expects($this
    ->never())
    ->method('get');
  $this->preloader
    ->onRequest($event);
}