Issue #3278124 by catch, nod_, andregp, quietone, deviantintegral, alexpott: Convert various tests that use bartik/seven to olivero/claro

merge-requests/2310/merge
catch 2022-07-14 14:35:28 +09:00
parent 646345c882
commit 40eeb20469
18 changed files with 88 additions and 88 deletions

View File

@ -6,7 +6,7 @@ use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\block\Traits\BlockCreationTrait;
/**
* Tests that the new default theme gets blocks.
* Tests that a new default theme gets blocks.
*
* @group block
*/
@ -23,7 +23,7 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
];
/**
* Check the enabled Bartik blocks are correctly copied over.
* Check the blocks are correctly copied by block_themes_installed().
*/
public function testNewDefaultThemeBlocks() {
$this->installConfig(['system']);
@ -44,8 +44,8 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
'id' => $default_theme . '_' . strtolower($this->randomMachineName(8)),
]);
// Install a different theme.
$new_theme = 'bartik';
// Install a different theme that does not have blocks.
$new_theme = 'test_theme';
// The new theme is different from the previous default theme.
$this->assertNotEquals($new_theme, $default_theme);
@ -69,7 +69,7 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
foreach ($default_block_names as $default_block_name) {
// Remove the matching block from the list of blocks in the new theme.
// E.g., if the old theme has block.block.stark_admin,
// unset block.block.bartik_admin.
// unset block.block.olivero_admin.
unset($new_blocks[str_replace($default_theme . '_', $new_theme . '_', $default_block_name)]);
}
$this->assertEmpty($new_blocks);

View File

@ -187,7 +187,7 @@ class ImageThemeFunctionTest extends KernelTestBase {
// Test using alt directly with alt attribute.
$image_with_alt_property = [
'#theme' => 'image',
'#uri' => '/core/themes/bartik/logo.svg',
'#uri' => '/core/themes/olivero/logo.svg',
'#alt' => 'Regular alt',
'#title' => 'Test title',
'#width' => '50%',
@ -202,7 +202,7 @@ class ImageThemeFunctionTest extends KernelTestBase {
// Test using alt attribute inside attributes.
$image_with_alt_attribute_alt_attribute = [
'#theme' => 'image',
'#uri' => '/core/themes/bartik/logo.svg',
'#uri' => '/core/themes/olivero/logo.svg',
'#width' => '50%',
'#height' => '50%',
'#attributes' => [
@ -220,7 +220,7 @@ class ImageThemeFunctionTest extends KernelTestBase {
// Test using alt attribute as property and inside attributes.
$image_with_alt_attribute_both = [
'#theme' => 'image',
'#uri' => '/core/themes/bartik/logo.svg',
'#uri' => '/core/themes/olivero/logo.svg',
'#width' => '50%',
'#height' => '50%',
'#alt' => 'Kitten sustainable',

View File

@ -52,7 +52,7 @@ function common_test_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
* Same as common_test_drupal_alter_alter(), but here, we verify that themes
* can also alter and come last.
*/
function bartik_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
function olivero_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
// Alter first argument.
if (is_array($data)) {
$data['foo'] .= ' theme';

View File

@ -29,10 +29,10 @@ class PageTest extends BrowserTestBase {
public function testBatchProgressPageTheme() {
// Make sure that the page which starts the batch (an administrative page)
// is using a different theme than would normally be used by the batch API.
$this->container->get('theme_installer')->install(['seven', 'bartik']);
$this->container->get('theme_installer')->install(['claro', 'olivero']);
$this->config('system.theme')
->set('default', 'bartik')
->set('admin', 'seven')
->set('default', 'olivero')
->set('admin', 'claro')
->save();
// Log in as an administrator who can see the administrative theme.
@ -45,7 +45,7 @@ class PageTest extends BrowserTestBase {
$this->drupalGet('admin/batch-test/test-theme');
// The stack should contain the name of the theme used on the progress
// page.
$this->assertEquals(['seven'], batch_test_stack(), 'A progressive batch correctly uses the theme of the page that started the batch.');
$this->assertEquals(['claro'], batch_test_stack(), 'A progressive batch correctly uses the theme of the page that started the batch.');
}
/**

View File

@ -27,10 +27,10 @@ class AlterTest extends BrowserTestBase {
* Tests if the theme has been altered.
*/
public function testDrupalAlter() {
// This test depends on Bartik, so make sure that it is always the current
// This test depends on Olivero, so make sure that it is always the current
// active theme.
\Drupal::service('theme_installer')->install(['bartik']);
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('bartik'));
\Drupal::service('theme_installer')->install(['olivero']);
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('olivero'));
$array = ['foo' => 'bar'];
$entity = new \stdClass();

View File

@ -241,8 +241,8 @@ class MenuRouterTest extends BrowserTestBase {
* Tests theme integration.
*/
public function testThemeIntegration() {
$this->defaultTheme = 'bartik';
$this->adminTheme = 'seven';
$this->defaultTheme = 'olivero';
$this->adminTheme = 'claro';
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
$theme_installer = $this->container->get('theme_installer');
@ -269,8 +269,8 @@ class MenuRouterTest extends BrowserTestBase {
*/
protected function doTestThemeCallbackAdministrative() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertSession()->pageTextContains('Active theme: seven. Actual theme: seven.');
$this->assertSession()->responseContains('seven/css/base/elements.css');
$this->assertSession()->pageTextContains('Active theme: claro. Actual theme: claro.');
$this->assertSession()->responseContains('claro/css/base/elements.css');
}
/**
@ -283,15 +283,15 @@ class MenuRouterTest extends BrowserTestBase {
// we expect the theme callback system to be bypassed entirely.
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
// Check that the maintenance theme's CSS appears on the page.
$this->assertSession()->responseContains('bartik/css/base/elements.css');
$this->assertSession()->responseContains('olivero/css/base/base.css');
// An administrator, however, should continue to see the requested theme.
$admin_user = $this->drupalCreateUser(['access site in maintenance mode']);
$this->drupalLogin($admin_user);
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertSession()->pageTextContains('Active theme: seven. Actual theme: seven.');
$this->assertSession()->pageTextContains('Active theme: claro. Actual theme: claro.');
// Check that the administrative theme's CSS appears on the page.
$this->assertSession()->responseContains('seven/css/base/elements.css');
$this->assertSession()->responseContains('claro/css/base/elements.css');
$this->container->get('state')->set('system.maintenance_mode', FALSE);
}
@ -302,9 +302,9 @@ class MenuRouterTest extends BrowserTestBase {
protected function doTestThemeCallbackOptionalTheme() {
// Request a theme that is not installed.
$this->drupalGet('menu-test/theme-callback/use-test-theme');
$this->assertSession()->pageTextContains('Active theme: bartik. Actual theme: bartik.');
$this->assertSession()->pageTextContains('Active theme: olivero. Actual theme: olivero.');
// Check that the default theme's CSS appears on the page.
$this->assertSession()->responseContains('bartik/css/base/elements.css');
$this->assertSession()->responseContains('olivero/css/base/base.css');
// Now install the theme and request it again.
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
@ -324,9 +324,9 @@ class MenuRouterTest extends BrowserTestBase {
*/
protected function doTestThemeCallbackFakeTheme() {
$this->drupalGet('menu-test/theme-callback/use-fake-theme');
$this->assertSession()->pageTextContains('Active theme: bartik. Actual theme: bartik.');
$this->assertSession()->pageTextContains('Active theme: olivero. Actual theme: olivero.');
// Check that the default theme's CSS appears on the page.
$this->assertSession()->responseContains('bartik/css/base/elements.css');
$this->assertSession()->responseContains('olivero/css/base/base.css');
}
/**
@ -334,9 +334,9 @@ class MenuRouterTest extends BrowserTestBase {
*/
protected function doTestThemeCallbackNoThemeRequested() {
$this->drupalGet('menu-test/theme-callback/no-theme-requested');
$this->assertSession()->pageTextContains('Active theme: bartik. Actual theme: bartik.');
$this->assertSession()->pageTextContains('Active theme: olivero. Actual theme: olivero.');
// Check that the default theme's CSS appears on the page.
$this->assertSession()->responseContains('bartik/css/base/elements.css');
$this->assertSession()->responseContains('olivero/css/base/base.css');
}
}

View File

@ -146,11 +146,11 @@ class SiteMaintenanceTest extends BrowserTestBase {
$this->submitForm([], 'Log in');
$this->assertSession()->pageTextContains($user_message);
// Regression test to check if title displays in Bartik on maintenance page.
\Drupal::service('theme_installer')->install(['bartik']);
$this->config('system.theme')->set('default', 'bartik')->save();
// Check if title displays in Olivero on maintenance page.
\Drupal::service('theme_installer')->install(['olivero']);
$this->config('system.theme')->set('default', 'olivero')->save();
// Logout and verify that offline message is displayed in Bartik.
// Logout and verify that offline message is displayed in Olivero.
$this->drupalLogout();
$this->drupalGet('');
$this->assertEquals('Site under maintenance', $this->cssSelect('main h1')[0]->getText());

View File

@ -60,7 +60,7 @@ class ThemeTest extends BrowserTestBase {
*/
public function testThemeSettings() {
// Ensure a disabled theme settings form URL returns 404.
$this->drupalGet('admin/appearance/settings/bartik');
$this->drupalGet('admin/appearance/settings/olivero');
$this->assertSession()->statusCodeEquals(404);
// Ensure a non existent theme settings form URL returns 404.
$this->drupalGet('admin/appearance/settings/' . $this->randomMachineName());
@ -194,14 +194,14 @@ class ThemeTest extends BrowserTestBase {
$this->drupalGet('');
$this->assertSession()->elementAttributeContains('xpath', '//header//a[@rel="home"]/img', 'src', $file_url_generator->generateString($uploaded_filename));
$this->container->get('theme_installer')->install(['bartik']);
$this->container->get('theme_installer')->install(['olivero']);
// Ensure only valid themes are listed in the local tasks.
$this->drupalPlaceBlock('local_tasks_block', ['region' => 'header']);
$this->drupalGet('admin/appearance/settings');
$theme_handler = \Drupal::service('theme_handler');
$this->assertSession()->linkExists($theme_handler->getName('classy'));
$this->assertSession()->linkExists($theme_handler->getName('bartik'));
$this->assertSession()->linkExists($theme_handler->getName('olivero'));
$this->assertSession()->linkNotExists($theme_handler->getName('stable'));
// If a hidden theme is an admin theme it should be viewable.
@ -231,14 +231,14 @@ class ThemeTest extends BrowserTestBase {
* Tests the theme settings logo form.
*/
public function testThemeSettingsLogo() {
// Visit Bartik's theme settings page to replace the logo.
$this->container->get('theme_installer')->install(['bartik']);
$this->drupalGet('admin/appearance/settings/bartik');
// Visit Olivero's theme settings page to replace the logo.
$this->container->get('theme_installer')->install(['olivero']);
$this->drupalGet('admin/appearance/settings/olivero');
$edit = [
'default_logo' => FALSE,
'logo_path' => 'core/misc/druplicon.png',
];
$this->drupalGet('admin/appearance/settings/bartik');
$this->drupalGet('admin/appearance/settings/olivero');
$this->submitForm($edit, 'Save configuration');
$this->assertSession()->fieldValueEquals('default_logo', FALSE);
$this->assertSession()->fieldValueEquals('logo_path', 'core/misc/druplicon.png');
@ -255,7 +255,7 @@ class ThemeTest extends BrowserTestBase {
* Tests the 'rendered' cache tag is cleared when saving theme settings.
*/
public function testThemeSettingsRenderCacheClear() {
$this->container->get('theme_installer')->install(['bartik']);
$this->container->get('theme_installer')->install(['olivero']);
// Ensure the frontpage is cached for anonymous users. The render cache will
// cleared by installing a theme.
$this->drupalLogout();
@ -265,9 +265,9 @@ class ThemeTest extends BrowserTestBase {
$this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT');
$this->drupalLogin($this->adminUser);
// Save Bartik's theme settings which should invalidate the 'rendered' cache
// Save Olivero's theme settings which should invalidate the 'rendered' cache
// tag in \Drupal\system\EventSubscriber\ConfigCacheTag.
$this->drupalGet('admin/appearance/settings/bartik');
$this->drupalGet('admin/appearance/settings/olivero');
$this->submitForm([], 'Save configuration');
$this->drupalLogout();
$this->drupalGet('');
@ -369,15 +369,15 @@ class ThemeTest extends BrowserTestBase {
$this->config('system.theme')->set('default', 'stark')->save();
$this->drupalPlaceBlock('local_tasks_block');
// Install Bartik and set it as the default theme.
$theme_installer->install(['bartik']);
// Install Olivero and set it as the default theme.
$theme_installer->install(['olivero']);
$this->drupalGet('admin/appearance');
$this->clickLink('Set as default');
$this->assertEquals('bartik', $this->config('system.theme')->get('default'));
$this->assertEquals('olivero', $this->config('system.theme')->get('default'));
// Test the default theme on the secondary links (blocks admin page).
$this->drupalGet('admin/structure/block');
$this->assertSession()->pageTextContains('Bartik(active tab)');
$this->assertSession()->pageTextContains('Olivero(active tab)');
// Switch back to Stark and test again to test that the menu cache is cleared.
$this->drupalGet('admin/appearance');
// Stark is the first 'Set as default' link.
@ -413,8 +413,8 @@ class ThemeTest extends BrowserTestBase {
* Tests uninstalling of themes works.
*/
public function testUninstallingThemes() {
// Install Bartik and set it as the default theme.
\Drupal::service('theme_installer')->install(['bartik']);
// Install Olivero and set it as the default theme.
\Drupal::service('theme_installer')->install(['olivero']);
// Set up seven as the admin theme.
\Drupal::service('theme_installer')->install(['seven']);
$edit = [
@ -428,10 +428,10 @@ class ThemeTest extends BrowserTestBase {
// Check that seven cannot be uninstalled as it is the admin theme.
$this->assertSession()->responseNotContains('Uninstall Seven theme');
// Check that bartik cannot be uninstalled as it is the default theme.
$this->assertSession()->responseNotContains('Uninstall Bartik theme');
// Check that olivero cannot be uninstalled as it is the default theme.
$this->assertSession()->responseNotContains('Uninstall Olivero theme');
// Check that the classy theme cannot be uninstalled as it is a base theme
// of seven and bartik.
// of seven and olivero.
$this->assertSession()->responseNotContains('Uninstall Classy theme');
// Install Stark and set it as the default theme.
@ -447,22 +447,22 @@ class ThemeTest extends BrowserTestBase {
// Check that seven can be uninstalled now.
$this->assertSession()->responseContains('Uninstall Seven theme');
// Check that the classy theme still cannot be uninstalled as it is a
// base theme of bartik.
// base theme of olivero.
$this->assertSession()->responseNotContains('Uninstall Classy theme');
// Change the default theme to stark, stark is second in the list.
$this->clickLink('Set as default', 1);
// Check that bartik can be uninstalled now.
$this->assertSession()->responseContains('Uninstall Bartik theme');
// Check that olivero can be uninstalled now.
$this->assertSession()->responseContains('Uninstall Olivero theme');
// Check that the classy theme still can't be uninstalled as neither of its
// base themes have been.
$this->assertSession()->responseNotContains('Uninstall Classy theme');
// Uninstall each of the three themes starting with Bartik.
// Uninstall each of the three themes starting with Olivero.
$this->clickLink('Uninstall');
$this->assertSession()->responseContains('The <em class="placeholder">Bartik</em> theme has been uninstalled');
$this->assertSession()->responseContains('The <em class="placeholder">Olivero</em> theme has been uninstalled');
// Seven is the second in the list.
$this->clickLink('Uninstall');
$this->assertSession()->responseContains('The <em class="placeholder">Seven</em> theme has been uninstalled');
@ -476,7 +476,7 @@ class ThemeTest extends BrowserTestBase {
*/
public function testInstallAndSetAsDefault() {
$themes = [
'bartik' => 'Bartik',
'olivero' => 'Olivero',
'test_core_semver' => 'Theme test with semver core version',
];
foreach ($themes as $theme_machine_name => $theme_name) {

View File

@ -39,7 +39,7 @@ class ConfigEntityImportTest extends KernelTestBase {
*/
public function testConfigUpdateImport() {
$this->installConfig(['action', 'block', 'filter', 'image']);
$this->container->get('theme_installer')->install(['bartik']);
$this->container->get('theme_installer')->install(['olivero']);
$config_storage = $this->container->get('config.storage');
// Ensure the 'system.site' config.
$config_storage->write('system.site', ['uuid' => (new Php())->generate()]);
@ -83,7 +83,7 @@ class ConfigEntityImportTest extends KernelTestBase {
$block = $this->placeBlock('system_powered_by_block', [
'id' => 'apple',
'label' => 'Red Delicious',
'theme' => 'bartik',
'theme' => 'olivero',
]);
$this->checkSinglePluginConfigSync($block, 'settings', 'label', 'Red Delicious');

View File

@ -332,10 +332,10 @@ class ModuleHandlerTest extends KernelTestBase {
public function testThemeMetaData() {
// Generate the list of available themes.
$themes = \Drupal::service('theme_handler')->rebuildThemeData();
// Check that the mtime field exists for the bartik theme.
$this->assertNotEmpty($themes['bartik']->info['mtime'], 'The bartik.info.yml file modification time field is present.');
// Check that the mtime field exists for the olivero theme.
$this->assertNotEmpty($themes['olivero']->info['mtime'], 'The olivero.info.yml file modification time field is present.');
// Use 0 if mtime isn't present, to avoid an array index notice.
$test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0;
$test_mtime = !empty($themes['olivero']->info['mtime']) ? $themes['olivero']->info['mtime'] : 0;
// Ensure the mtime field contains a number that is greater than zero.
$this->assertIsNumeric($test_mtime);
$this->assertGreaterThan(0, $test_mtime);

View File

@ -31,7 +31,7 @@ class TwigNamespaceTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
\Drupal::service('theme_installer')->install(['test_theme', 'bartik']);
\Drupal::service('theme_installer')->install(['test_theme', 'olivero']);
$this->twig = \Drupal::service('twig');
}
@ -52,7 +52,7 @@ class TwigNamespaceTest extends KernelTestBase {
$this->assertTwigTemplate($this->twig->load('@node/node.html.twig'), 'Found node.html.twig in node module.');
// Tests resolving namespaced templates in themes.
$this->assertTwigTemplate($this->twig->load('@bartik/page.html.twig'), 'Found page.html.twig in Bartik theme.');
$this->assertTwigTemplate($this->twig->load('@olivero/layout/page.html.twig'), 'Found page.html.twig in Olivero theme.');
}
/**

View File

@ -31,17 +31,17 @@ class SystemLocalTasksTest extends LocalTaskIntegrationTestBase {
$this->themeHandler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface');
$theme = new Extension($this->root, 'theme', 'core/themes/bartik', 'bartik.info.yml');
$theme = new Extension($this->root, 'theme', 'core/themes/olivero', 'olivero.info.yml');
$theme->status = 1;
$theme->info = ['name' => 'bartik'];
$theme->info = ['name' => 'olivero'];
$this->themeHandler->expects($this->any())
->method('listInfo')
->will($this->returnValue([
'bartik' => $theme,
'olivero' => $theme,
]));
$this->themeHandler->expects($this->any())
->method('hasUi')
->with('bartik')
->with('olivero')
->willReturn(TRUE);
$this->container->set('theme_handler', $this->themeHandler);
}
@ -65,7 +65,7 @@ class SystemLocalTasksTest extends LocalTaskIntegrationTestBase {
'system.theme_settings_theme',
[
['system.themes_page', 'system.theme_settings'],
['system.theme_settings_global', 'system.theme_settings_theme:bartik'],
['system.theme_settings_global', 'system.theme_settings_theme:olivero'],
],
],
];

View File

@ -56,7 +56,7 @@ class TourTest extends TourTestBasic {
parent::setUp();
$this->drupalPlaceBlock('local_actions_block', [
'theme' => 'seven',
'theme' => 'claro',
'region' => 'content',
]);
}

View File

@ -44,10 +44,10 @@ abstract class TourTestBasic extends TourTestBase {
// Make sure we are using distinct default and administrative themes for
// the duration of these tests.
$this->container->get('theme_installer')->install(['bartik', 'seven']);
$this->container->get('theme_installer')->install(['olivero', 'claro']);
$this->config('system.theme')
->set('default', 'bartik')
->set('admin', 'seven')
->set('default', 'olivero')
->set('admin', 'claro')
->save();
$this->permissions[] = 'view the administration theme';

View File

@ -35,7 +35,7 @@ class AdminNegotiatorTest extends UnitTestCase {
*/
public function getThemes() {
return [
['seven', 'seven'],
['claro', 'claro'],
[NULL, NULL],
['', NULL],
];

View File

@ -19,14 +19,14 @@ display:
field: entity_block
id: entity_block
table: views
target: 'bartik_powered'
target: 'id_olivero_powered'
view_mode: full
plugin_id: entity
entity_block_1:
field: entity_block
id: entity_block
table: views
target: 'bartik_branding'
target: 'id_olivero_branding'
view_mode: full
plugin_id: entity
fields:

View File

@ -46,8 +46,8 @@ class AreaEntityTest extends ViewsKernelTestBase {
*/
protected function setUpFixtures() {
// Install the themes used for this test.
$this->container->get('theme_installer')->install(['bartik']);
$this->container->get('config.factory')->getEditable('system.theme')->set('default', 'bartik')->save();
$this->container->get('theme_installer')->install(['olivero']);
$this->container->get('config.factory')->getEditable('system.theme')->set('default', 'olivero')->save();
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test');

View File

@ -35,18 +35,18 @@ class AreaOrderTest extends ViewsKernelTestBase {
*/
protected function setUpFixtures() {
// Install the themes used for this test.
$this->container->get('theme_installer')->install(['bartik']);
$this->container->get('theme_installer')->install(['olivero']);
$this->placeBlock('system_branding_block', [
'id' => 'bartik_branding',
'theme' => 'bartik',
'id' => 'id_olivero_branding',
'theme' => 'olivero',
'plugin' => 'system_branding_block',
'weight' => 1,
]);
$this->placeBlock('system_powered_by_block', [
'id' => 'bartik_powered',
'theme' => 'bartik',
'id' => 'id_olivero_powered',
'theme' => 'olivero',
'weight' => 2,
]);
@ -61,11 +61,11 @@ class AreaOrderTest extends ViewsKernelTestBase {
$renderable = $view->buildRenderable();
$output = $this->render($renderable);
$position_powered = strpos($output, 'block-bartik-powered');
$position_branding = strpos($output, 'block-bartik-branding');
$position_powered = strpos($output, 'block-id-olivero-powered');
$position_branding = strpos($output, 'block-id-olivero-branding');
$this->assertNotEquals(0, $position_powered, 'ID bartik-powered found.');
$this->assertNotEquals(0, $position_branding, 'ID bartik-branding found');
$this->assertNotEquals(0, $position_powered, 'ID olivero-powered found.');
$this->assertNotEquals(0, $position_branding, 'ID olivero-branding found');
// Make sure "powered" is before "branding", so it reflects the position
// in the configuration, and not the weight of the blocks.