function ContentModerationRouteSubscriberTest::testSetLatestRevisionFlag
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Unit/ContentModerationRouteSubscriberTest.php \Drupal\Tests\content_moderation\Unit\ContentModerationRouteSubscriberTest::testSetLatestRevisionFlag()
- 10 core/modules/content_moderation/tests/src/Unit/ContentModerationRouteSubscriberTest.php \Drupal\Tests\content_moderation\Unit\ContentModerationRouteSubscriberTest::testSetLatestRevisionFlag()
- 11.x core/modules/content_moderation/tests/src/Unit/ContentModerationRouteSubscriberTest.php \Drupal\Tests\content_moderation\Unit\ContentModerationRouteSubscriberTest::testSetLatestRevisionFlag()
Tests that the "load_latest_revision" flag is handled correctly.
@covers ::setLatestRevisionFlag
@dataProvider setLatestRevisionFlagTestCases
Parameters
array $defaults: The route defaults.
array $parameters: The route parameters.
array|bool $expected_parameters: (optional) The expected route parameters. Defaults to FALSE.
File
-
core/
modules/ content_moderation/ tests/ src/ Unit/ ContentModerationRouteSubscriberTest.php, line 229
Class
- ContentModerationRouteSubscriberTest
- @coversDefaultClass \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber
Namespace
Drupal\Tests\content_moderation\UnitCode
public function testSetLatestRevisionFlag($defaults, $parameters, $expected_parameters = FALSE) {
$route = new Route('/foo/{entity_test}', $defaults, [], [
'parameters' => $parameters,
]);
$route_collection = new RouteCollection();
$route_collection->add('test', $route);
$event = new RouteBuildEvent($route_collection);
$this->routeSubscriber
->onAlterRoutes($event);
// If expected parameters have not been provided, assert they are unchanged.
$this->assertEquals($expected_parameters ?: $parameters, $route->getOption('parameters'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.