You are here

public function RoutePreloaderTest::testOnRequestNonHtml in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnRequestNonHtml()
  2. 9 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 141

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);
}