Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / content_translation / tests / src / Unit / Menu / ContentTranslationLocalTasksTest.php
1 <?php
2
3 namespace Drupal\Tests\content_translation\Unit\Menu;
4
5 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
6
7 /**
8  * Tests content translation local tasks.
9  *
10  * @group content_translation
11  */
12 class ContentTranslationLocalTasksTest extends LocalTaskIntegrationTestBase {
13
14   protected function setUp() {
15     $this->directoryList = [
16       'content_translation' => 'core/modules/content_translation',
17       'node' => 'core/modules/node',
18     ];
19     parent::setUp();
20
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'],
27       ]));
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,
33       ]));
34     \Drupal::getContainer()->set('content_translation.manager', $content_translation_manager);
35     \Drupal::getContainer()->set('string_translation', $this->getStringTranslationStub());
36   }
37
38   /**
39    * Tests the block admin display local tasks.
40    *
41    * @dataProvider providerTestBlockAdminDisplay
42    */
43   public function testBlockAdminDisplay($route, $expected) {
44     $this->assertLocalTasks($route, $expected);
45   }
46
47   /**
48    * Provides a list of routes to test.
49    */
50   public function providerTestBlockAdminDisplay() {
51     return [
52       [
53         'entity.node.canonical',
54         [
55           [
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',
61           ],
62         ],
63       ],
64       [
65         'entity.node.content_translation_overview',
66         [
67           [
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',
73           ],
74         ],
75       ],
76     ];
77   }
78
79 }