class UnsupportedRouteAttributePropertiesTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Routing/UnsupportedRouteAttributePropertiesTest.php \Drupal\Tests\Core\Routing\UnsupportedRouteAttributePropertiesTest
Tests \Drupal\Core\Routing\AttributeRouteDiscovery.
Attributes
#[CoversClass(AttributeRouteDiscovery::class)]
#[Group('Routing')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Routing\UnsupportedRouteAttributePropertiesTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of UnsupportedRouteAttributePropertiesTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ UnsupportedRouteAttributePropertiesTest.php, line 18
Namespace
Drupal\Tests\Core\RoutingView source
class UnsupportedRouteAttributePropertiesTest extends UnitTestCase {
/**
* @legacy-covers ::createRouteCollection
*/
public function testException(string $class, string $message) : void {
$discovery = new AttributeRouteDiscovery(new \ArrayIterator());
$reflection = new \ReflectionClass($discovery);
$method = $reflection->getMethod('createRouteCollection');
$this->expectException(UnsupportedRouteAttributePropertyException::class);
$this->expectExceptionMessage($message);
$method->invoke($discovery, $class);
}
public static function providerTestException() : array {
return [
'method: missing_name' => [
MethodRouteMissingName::class,
'The Route attribute on "Drupal\\Tests\\Core\\Routing\\MethodRouteMissingName::attributeMethod()" is missing a required "name" property.',
],
'method: locale' => [
MethodRouteLocale::class,
'The "locale" route attribute is not supported on route "MethodRouteLocale" in "Drupal\\Tests\\Core\\Routing\\MethodRouteLocale::attributeMethod()"',
],
'method: localized_paths' => [
MethodRouteLocalizedPaths::class,
'The "path" route attribute does not support arrays on route "MethodRouteLocalizedPaths" in "Drupal\\Tests\\Core\\Routing\\MethodRouteLocalizedPaths::attributeMethod()"',
],
'method: condition' => [
MethodRouteCondition::class,
'The "condition" route attribute is not supported on route "MethodRouteCondition" in "Drupal\\Tests\\Core\\Routing\\MethodRouteCondition::attributeMethod()"',
],
'class: locale' => [
ClassRouteLocale::class,
'The "locale" route attribute is not supported in class "Drupal\\Tests\\Core\\Routing\\ClassRouteLocale"',
],
'class: localized_paths' => [
ClassRouteLocalizedPaths::class,
'The "path" route attribute does not support arrays in class "Drupal\\Tests\\Core\\Routing\\ClassRouteLocalizedPaths"',
],
'class: condition' => [
ClassRouteCondition::class,
'The "condition" route attribute is not supported in class "Drupal\\Tests\\Core\\Routing\\ClassRouteCondition"',
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.