Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / src / Unit / Menu / SystemLocalTasksTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Unit\Menu;
4
5 use Drupal\Core\Extension\Extension;
6 use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;
7
8 /**
9  * Tests existence of system local tasks.
10  *
11  * @group system
12  */
13 class SystemLocalTasksTest extends LocalTaskIntegrationTestBase {
14
15   /**
16    * The mocked theme handler.
17    *
18    * @var \Drupal\Core\Extension\ThemeHandlerInterface|\PHPUnit_Framework_MockObject_MockObject
19    */
20   protected $themeHandler;
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function setUp() {
26     parent::setUp();
27
28     $this->directoryList = [
29       'system' => 'core/modules/system',
30     ];
31
32     $this->themeHandler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
33
34     $theme = new Extension($this->root, 'theme', '/core/themes/bartik', 'bartik.info.yml');
35     $theme->status = 1;
36     $theme->info = ['name' => 'bartik'];
37     $this->themeHandler->expects($this->any())
38       ->method('listInfo')
39       ->will($this->returnValue([
40         'bartik' => $theme,
41       ]));
42     $this->themeHandler->expects($this->any())
43       ->method('hasUi')
44       ->with('bartik')
45       ->willReturn(TRUE);
46     $this->container->set('theme_handler', $this->themeHandler);
47   }
48
49   /**
50    * Tests local task existence.
51    *
52    * @dataProvider getSystemAdminRoutes
53    */
54   public function testSystemAdminLocalTasks($route, $expected) {
55     $this->assertLocalTasks($route, $expected);
56   }
57
58   /**
59    * Provides a list of routes to test.
60    */
61   public function getSystemAdminRoutes() {
62     return [
63       ['system.admin_content', [['system.admin_content']]],
64       [
65         'system.theme_settings_theme',
66         [
67           ['system.themes_page', 'system.theme_settings'],
68           ['system.theme_settings_global', 'system.theme_settings_theme:bartik'],
69         ],
70       ],
71     ];
72   }
73
74 }