public function RevisionOverviewIntegrationTest::testIntegration in Entity API 8.0
File
- tests/
Kernel/ RevisionOverviewIntegrationTest.php, line 37 - Contains \Drupal\Tests\entity\Kernel\RevisionOverviewIntegrationTest.
Class
- RevisionOverviewIntegrationTest
- Tests some integration of the revision overview:
Namespace
Drupal\Tests\entity\KernelCode
public function testIntegration() {
/** @var \Drupal\Core\Menu\LocalTaskManagerInterface $local_tasks_manager */
$local_tasks_manager = \Drupal::service('plugin.manager.menu.local_task');
$tasks = $local_tasks_manager
->getDefinitions();
$this
->assertArrayHasKey('entity.revisions_overview:entity_test_enhanced', $tasks);
$this
->assertArrayNotHasKey('entity.revisions_overview:node', $tasks, 'Node should have been excluded because it provides their own');
$this
->assertEquals('entity.entity_test_enhanced.version_history', $tasks['entity.revisions_overview:entity_test_enhanced']['route_name']);
$this
->assertEquals('entity.entity_test_enhanced.edit_form', $tasks['entity.revisions_overview:entity_test_enhanced']['base_route']);
/** @var \Drupal\Core\Routing\RouteProviderInterface $route_provider */
$route_provider = \Drupal::service('router.route_provider');
$route = $route_provider
->getRouteByName('entity.entity_test_enhanced.version_history');
$this
->assertInstanceOf(Route::class, $route);
$this
->assertEquals('\\Drupal\\entity\\Controller\\RevisionOverviewController::revisionOverviewController', $route
->getDefault('_controller'));
}