function UnsupportedRouteAttributePropertiesTest::testException

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Routing/UnsupportedRouteAttributePropertiesTest.php \Drupal\Tests\Core\Routing\UnsupportedRouteAttributePropertiesTest::testException()

@legacy-covers ::createRouteCollection

Attributes

#[DataProvider('providerTestException')]

File

core/tests/Drupal/Tests/Core/Routing/UnsupportedRouteAttributePropertiesTest.php, line 27

Class

UnsupportedRouteAttributePropertiesTest
Tests \Drupal\Core\Routing\AttributeRouteDiscovery.

Namespace

Drupal\Tests\Core\Routing

Code

public function testException(string $class, string $message, bool $isForm = FALSE) : void {
  $discovery = new AttributeRouteDiscovery(new \ArrayIterator());
  $reflection = new \ReflectionClass($discovery);
  $method = $reflection->getMethod($isForm ? 'createFormRouteCollection' : 'createControllerRouteCollection');
  $this->expectException(UnsupportedRouteAttributePropertyException::class);
  $this->expectExceptionMessage($message);
  $method->invoke($discovery, new \ReflectionClass($class));
}

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