function LazyRouteCollectionTest::testGetName
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php \Drupal\Tests\Core\Routing\LazyRouteCollectionTest::testGetName()
- 10 core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php \Drupal\Tests\Core\Routing\LazyRouteCollectionTest::testGetName()
Search for a both an existing and a non-existing route.
@covers ::get
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ LazyRouteCollectionTest.php, line 77
Class
- LazyRouteCollectionTest
- @coversDefaultClass \Drupal\Core\Routing\LazyRouteCollection
Namespace
Drupal\Tests\Core\RoutingCode
public function testGetName() : void {
// Hit.
$this->routeProvider
->method('getRouteByName')
->with('route_1')
->willReturn($this->testRoutes['route_1']);
$lazyRouteCollection = new LazyRouteCollection($this->routeProvider);
$this->assertEquals($lazyRouteCollection->get('route_1'), $this->testRoutes['route_1']);
// Miss.
$this->routeProvider
->method('getRouteByName')
->with('does_not_exist')
->will($this->throwException(new RouteNotFoundException()));
$lazyRouteCollectionFail = new LazyRouteCollection($this->routeProvider);
$this->assertNull($lazyRouteCollectionFail->get('does_not_exist'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.