function RoutePreloaderTest::testOnRequestOnHtml

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnRequestOnHtml()
  2. 10 core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnRequestOnHtml()
  3. 11.x 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 162

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')
        ->willReturn($request);
    $this->routeProvider
        ->expects($this->once())
        ->method('preLoadRoutes')
        ->with([
        'test2',
    ]);
    $this->state
        ->expects($this->once())
        ->method('get')
        ->with('routing.non_admin_routes')
        ->willReturn([
        'test2',
    ]);
    $this->preloader
        ->onRequest($event);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.