From fa54f53f07c304b63773ea28c2766383ff28fd1c Mon Sep 17 00:00:00 2001 From: catch Date: Fri, 22 Jul 2022 13:51:58 +0900 Subject: [PATCH] Issue #3281449 by longwave, nod_, deviantintegral: Update Core unit tests to not use Bartik and Seven (cherry picked from commit 5645eeba076ecf6fe03a5e4e3492de7a1e5ebf79) --- .../Drupal/Tests/Core/Asset/AssetResolverTest.php | 3 --- .../Core/Asset/CssCollectionGrouperUnitTest.php | 4 ++-- .../Drupal/Tests/Core/Command/GenerateThemeTest.php | 4 ++-- .../Tests/Core/Extension/ExtensionDiscoveryTest.php | 7 ------- .../Drupal/Tests/Core/Extension/ThemeHandlerTest.php | 10 +++++----- .../Tests/Core/Theme/AjaxBasePageNegotiatorTest.php | 12 ++++++------ 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php index f0f3cbf93c1..f9f58764db8 100644 --- a/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php @@ -86,9 +86,6 @@ class AssetResolverTest extends UnitTestCase { $active_theme = $this->getMockBuilder('\Drupal\Core\Theme\ActiveTheme') ->disableOriginalConstructor() ->getMock(); - $active_theme->expects($this->any()) - ->method('getName') - ->willReturn('bartik'); $this->themeManager->expects($this->any()) ->method('getActiveTheme') ->willReturn($active_theme); diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php index 2c7fad24627..fb6b0fed24b 100644 --- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php @@ -81,7 +81,7 @@ class CssCollectionGrouperUnitTest extends UnitTestCase { 'type' => 'file', 'weight' => 0.001, 'preprocess' => TRUE, - 'data' => 'core/themes/bartik/css/base/elements.css', + 'data' => 'core/themes/example/css/base/elements.css', 'basename' => 'elements.css', ], 'print.css' => [ @@ -90,7 +90,7 @@ class CssCollectionGrouperUnitTest extends UnitTestCase { 'type' => 'file', 'weight' => 0.003, 'preprocess' => TRUE, - 'data' => 'core/themes/bartik/css/print.css', + 'data' => 'core/themes/example/css/print.css', 'basename' => 'print.css', ], ]; diff --git a/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php b/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php index 792c707e1e2..9ebc09bdc8c 100644 --- a/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php +++ b/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php @@ -311,12 +311,12 @@ SH; '--name="Test custom starterkit theme"', '--description="Custom theme generated from a starterkit theme"', '--starterkit', - 'bartik', + 'olivero', ]; $process = new Process($install_command, NULL); $process->setTimeout(60); $result = $process->run(); - $this->assertStringContainsString('Theme source theme bartik is not a valid starter kit.', trim($process->getErrorOutput())); + $this->assertStringContainsString('Theme source theme olivero is not a valid starter kit.', trim($process->getErrorOutput())); $this->assertSame(1, $result); } diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php index 70809aabbec..e70e05c0f51 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php @@ -141,13 +141,6 @@ class ExtensionDiscoveryTest extends UnitTestCase { 'core/modules/user/user.info.yml' => [], 'profiles/other_profile/modules/other_profile_nested_module/other_profile_nested_module.info.yml' => [], 'core/modules/system/system.info.yml' => [], - 'core/themes/seven/seven.info.yml' => [ - 'type' => 'theme', - ], - // Override the core instance of the 'seven' theme. - 'sites/default/themes/seven/seven.info.yml' => [ - 'type' => 'theme', - ], 'modules/devel/devel.info.yml' => [], 'modules/poorly_placed_theme/poorly_placed_theme.info.yml' => [ 'type' => 'theme', diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index fcf69c16bbb..c06d828c848 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -80,18 +80,18 @@ class ThemeHandlerTest extends UnitTestCase { $this->themeList->expects($this->once()) ->method('getList') ->will($this->returnValue([ - 'seven' => new Extension($this->root, 'theme', 'core/themes/seven/seven.info.yml', 'seven.theme'), + 'stark' => new Extension($this->root, 'theme', 'core/themes/stark/stark.info.yml', 'stark.theme'), ])); $theme_data = $this->themeHandler->rebuildThemeData(); $this->assertCount(1, $theme_data); - $info = $theme_data['seven']; + $info = $theme_data['stark']; // Ensure some basic properties. $this->assertInstanceOf('Drupal\Core\Extension\Extension', $info); - $this->assertEquals('seven', $info->getName()); - $this->assertEquals('core/themes/seven/seven.info.yml', $info->getPathname()); - $this->assertEquals('core/themes/seven/seven.theme', $info->getExtensionPathname()); + $this->assertEquals('stark', $info->getName()); + $this->assertEquals('core/themes/stark/stark.info.yml', $info->getPathname()); + $this->assertEquals('core/themes/stark/stark.theme', $info->getExtensionPathname()); } diff --git a/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php index ce62788bf42..538b9c33a71 100644 --- a/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php @@ -45,7 +45,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { parent::setUp(); $this->tokenGenerator = $this->prophesize(CsrfTokenGenerator::class); - $config_factory = $this->getConfigFactoryStub(['system.theme' => ['default' => 'bartik']]); + $config_factory = $this->getConfigFactoryStub(['system.theme' => ['default' => 'stark']]); $this->requestStack = new RequestStack(); $this->negotiator = new AjaxBasePageNegotiator($this->tokenGenerator->reveal(), $config_factory, $this->requestStack); } @@ -68,8 +68,8 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { $data = []; $data['empty'] = [[], FALSE]; $data['no_theme'] = [['ajax_page_state' => ['theme' => '', 'theme_token' => '']], FALSE]; - $data['valid_theme_empty_theme_token'] = [['ajax_page_state' => ['theme' => 'seven', 'theme_token' => '']], TRUE]; - $data['valid_theme_valid_theme_token'] = [['ajax_page_state' => ['theme' => 'seven', 'theme_token' => 'valid_theme_token']], TRUE]; + $data['valid_theme_empty_theme_token'] = [['ajax_page_state' => ['theme' => 'claro', 'theme_token' => '']], TRUE]; + $data['valid_theme_valid_theme_token'] = [['ajax_page_state' => ['theme' => 'claro', 'theme_token' => 'valid_theme_token']], TRUE]; return $data; } @@ -77,7 +77,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { * @covers ::determineActiveTheme */ public function testDetermineActiveThemeValidToken() { - $theme = 'seven'; + $theme = 'claro'; $theme_token = 'valid_theme_token'; $request = new Request([], ['ajax_page_state' => ['theme' => $theme, 'theme_token' => $theme_token]]); @@ -95,7 +95,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { * @covers ::determineActiveTheme */ public function testDetermineActiveThemeInvalidToken() { - $theme = 'seven'; + $theme = 'claro'; $theme_token = 'invalid_theme_token'; $request = new Request([], ['ajax_page_state' => ['theme' => $theme, 'theme_token' => $theme_token]]); @@ -113,7 +113,7 @@ class AjaxBasePageNegotiatorTest extends UnitTestCase { * @covers ::determineActiveTheme */ public function testDetermineActiveThemeDefaultTheme() { - $theme = 'bartik'; + $theme = 'stark'; // When the theme is the system default, an empty string is provided as the // theme token. See system_js_settings_alter(). $theme_token = '';