Skip to content
Snippets Groups Projects
Commit e4e981a8 authored by catch's avatar catch
Browse files

Issue #3427176 by mondrake, longwave: Replace calls to ::expectWarning*() from...

Issue #3427176 by mondrake, longwave: Replace calls to ::expectWarning*() from Drupal\Tests\Core\EventSubscriber\SpecialAttributesRouteSubscriberTest
parent 3a3e6186
No related branches found
No related tags found
No related merge requests found
......@@ -2192,18 +2192,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php',
];
$ignoreErrors[] = [
'message' => '#^Call to deprecated method expectWarning\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#',
'count' => 1,
'path' => __DIR__ . '/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php',
];
$ignoreErrors[] = [
'message' => '#^Call to deprecated method expectWarningMessage\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\:
https\\://github\\.com/sebastianbergmann/phpunit/issues/5062$#',
'count' => 1,
'path' => __DIR__ . '/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php',
];
$ignoreErrors[] = [
'message' => '#^Call to deprecated method getConfig\\(\\) of class GuzzleHttp\\\\Client\\:
Client\\:\\:getConfig will be removed in guzzlehttp/guzzle\\:8\\.0\\.$#',
......
......@@ -29,7 +29,7 @@ protected function alterRoutes(RouteCollection $collection) {
foreach ($collection->all() as $name => $route) {
if ($not_allowed_variables = array_intersect($route->compile()->getVariables(), $special_variables)) {
$reserved = implode(', ', $not_allowed_variables);
trigger_error(sprintf('Route %s uses reserved variable names: %s', $name, $reserved), E_USER_WARNING);
throw new \InvalidArgumentException(sprintf('Route %s uses reserved variable names: %s', $name, $reserved));
}
}
}
......
......@@ -100,8 +100,8 @@ public function testOnRouteBuildingInvalidVariables(Route $route) {
$event = new RouteBuildEvent($route_collection);
$subscriber = new SpecialAttributesRouteSubscriber();
$this->expectWarning();
$this->expectWarningMessage('uses reserved variable names');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Route test uses reserved variable names:');
$subscriber->onAlterRoutes($event);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment