class NavigationEntityRouteHelperTest
Tests \Drupal\navigation\EntityRouteHelper.
Attributes
#[Group('navigation')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\navigation\Kernel\NavigationEntityRouteHelperTest extends \Drupal\KernelTests\KernelTestBase
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\KernelView 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.