function NavigationEntityRouteHelperTest::testGetContentEntityFromRouteWithNonExistentRoute

Tests getContentEntityFromRoute() method when the route does not exist.

File

core/modules/navigation/tests/src/Kernel/NavigationEntityRouteHelperTest.php, line 34

Class

NavigationEntityRouteHelperTest
Tests \Drupal\navigation\EntityRouteHelper.

Namespace

Drupal\Tests\navigation\Kernel

Code

public function testGetContentEntityFromRouteWithNonExistentRoute() : void {
  $request = Request::create('/does-not-exist');
  $response = $this->container
    ->get('http_kernel')
    ->handle($request);
  $this->assertEquals(404, $response->getStatusCode());
  $this->assertNull($this->container
    ->get('navigation.entity_route_helper')
    ->getContentEntityFromRoute());
}

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