class NavigationEntityRouteHelperTest

Tests \Drupal\navigation\EntityRouteHelper.

Attributes

#[Group('navigation')] #[RunTestsInSeparateProcesses]

Hierarchy

Expanded class hierarchy of NavigationEntityRouteHelperTest

See also

\Drupal\navigation\EntityRouteHelper

File

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

Namespace

Drupal\Tests\navigation\Kernel
View source
class NavigationEntityRouteHelperTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
    'navigation',
    'layout_builder',
    'user',
  ];
  
  /**
   * Tests getContentEntityFromRoute() method when the route does not exist.
   */
  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.