You are here

public function RoutePreloaderTest::testOnRequestOnHtml in Zircon Profile 8.0

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

Tests onRequest on a html request.

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

public function testOnRequestOnHtml() {
  $event = $this
    ->getMockBuilder('\\Symfony\\Component\\HttpKernel\\Event\\KernelEvent')
    ->disableOriginalConstructor()
    ->getMock();
  $request = new Request();
  $request
    ->setRequestFormat('html');
  $event
    ->expects($this
    ->any())
    ->method('getRequest')
    ->will($this
    ->returnValue($request));
  $this->routeProvider
    ->expects($this
    ->once())
    ->method('preLoadRoutes')
    ->with([
    'test2',
  ]);
  $this->state
    ->expects($this
    ->once())
    ->method('get')
    ->with('routing.non_admin_routes')
    ->will($this
    ->returnValue(array(
    'test2',
  )));
  $this->preloader
    ->onRequest($event);
}