3 namespace Drupal\Tests\content_translation\Unit\Menu;
5 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
8 * Tests content translation local tasks.
10 * @group content_translation
12 class ContentTranslationLocalTasksTest extends LocalTaskIntegrationTestBase {
14 protected function setUp() {
15 $this->directoryList = [
16 'content_translation' => 'core/modules/content_translation',
17 'node' => 'core/modules/node',
21 $entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
22 $entity_type->expects($this->any())
23 ->method('getLinkTemplate')
24 ->will($this->returnValueMap([
25 ['canonical', 'entity.node.canonical'],
26 ['drupal:content-translation-overview', 'entity.node.content_translation_overview'],
28 $content_translation_manager = $this->getMock('Drupal\content_translation\ContentTranslationManagerInterface');
29 $content_translation_manager->expects($this->any())
30 ->method('getSupportedEntityTypes')
31 ->will($this->returnValue([
32 'node' => $entity_type,
34 \Drupal::getContainer()->set('content_translation.manager', $content_translation_manager);
35 \Drupal::getContainer()->set('string_translation', $this->getStringTranslationStub());
39 * Tests the block admin display local tasks.
41 * @dataProvider providerTestBlockAdminDisplay
43 public function testBlockAdminDisplay($route, $expected) {
44 $this->assertLocalTasks($route, $expected);
48 * Provides a list of routes to test.
50 public function providerTestBlockAdminDisplay() {
53 'entity.node.canonical',
56 'content_translation.local_tasks:entity.node.content_translation_overview',
57 'entity.node.canonical',
58 'entity.node.edit_form',
59 'entity.node.delete_form',
60 'entity.node.version_history',
65 'entity.node.content_translation_overview',
68 'content_translation.local_tasks:entity.node.content_translation_overview',
69 'entity.node.canonical',
70 'entity.node.edit_form',
71 'entity.node.delete_form',
72 'entity.node.version_history',