Issue #2350823 by lauriii, jhedstrom, Tim Bozeman, cilefen, davidhernandez, inqui, Cottser, xjm: Use the Classy theme in the Testing profile

8.0.x
Alex Pott 2014-11-23 10:33:46 +00:00
parent d8776af599
commit bbb4de91bc
25 changed files with 63 additions and 48 deletions

View File

@ -74,7 +74,7 @@ class BlockConfigSchemaTest extends KernelTestBase {
$id = strtolower($this->randomMachineName());
$block = Block::create(array(
'id' => $id,
'theme' => 'stark',
'theme' => 'classy',
'weight' => 00,
'status' => TRUE,
'region' => 'content',

View File

@ -190,7 +190,7 @@ class BlockTest extends BlockTestBase {
// Install all themes.
\Drupal::service('theme_handler')->install(array('bartik', 'seven'));
$theme_settings = $this->container->get('config.factory')->get('system.theme');
foreach (array('bartik', 'stark', 'seven') as $theme) {
foreach (array('bartik', 'classy', 'seven') as $theme) {
$this->drupalGet('admin/structure/block/list/' . $theme);
$this->assertTitle(t('Block layout') . ' | Drupal');
// Select the 'Powered by Drupal' block to be placed.
@ -326,7 +326,7 @@ class BlockTest extends BlockTestBase {
$cid = sha1(implode(':', $cid_parts));
$cache_entry = \Drupal::cache('render')->get($cid);
$expected_cache_tags = array(
'theme:stark',
'theme:classy',
'theme_global_settings',
'block_view',
'block:powered',
@ -335,11 +335,11 @@ class BlockTest extends BlockTestBase {
);
sort($expected_cache_tags);
$this->assertIdentical($cache_entry->tags, $expected_cache_tags);
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered:en:stark');
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered:en:classy');
$expected_cache_tags = array(
'block_view',
'block:powered',
'theme:stark',
'theme:classy',
'block_plugin:system_powered_by_block',
'rendered',
);
@ -368,7 +368,7 @@ class BlockTest extends BlockTestBase {
$cid = sha1(implode(':', $cid_parts));
$cache_entry = \Drupal::cache('render')->get($cid);
$expected_cache_tags = array(
'theme:stark',
'theme:classy',
'theme_global_settings',
'block_view',
'block:powered-2',
@ -381,22 +381,22 @@ class BlockTest extends BlockTestBase {
$expected_cache_tags = array(
'block_view',
'block:powered',
'theme:stark',
'theme:classy',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered:en:stark');
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered:en:classy');
$this->assertIdentical($cache_entry->tags, $expected_cache_tags);
$expected_cache_tags = array(
'block_view',
'block:powered-2',
'theme:stark',
'theme:classy',
'block_plugin:system_powered_by_block',
'rendered',
);
sort($expected_cache_tags);
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered-2:en:stark');
$cache_entry = \Drupal::cache('render')->get('entity_view:block:powered-2:en:classy');
$this->assertIdentical($cache_entry->tags, $expected_cache_tags);
// The plugin providing the "Powered by Drupal" block is modified; verify a
@ -428,7 +428,7 @@ class BlockTest extends BlockTestBase {
$this->drupalGet('<front>');
$this->assertText('Powered by Drupal');
$theme_handler->setDefault('stark');
$theme_handler->setDefault('classy');
$theme_handler->uninstall(['seven']);
// Ensure that the block configuration does not exist anymore.

View File

@ -82,7 +82,7 @@ class BlockUiTest extends WebTestBase {
public function testBlockDemoUiPage() {
$this->drupalPlaceBlock('system_help_block', array('region' => 'help'));
$this->drupalGet('admin/structure/block');
$this->clickLink(t('Demonstrate block regions (@theme)', array('@theme' => 'Stark')));
$this->clickLink(t('Demonstrate block regions (@theme)', array('@theme' => 'Classy')));
$elements = $this->xpath('//div[contains(@class, "region-highlighted")]/div[contains(@class, "block-region") and contains(text(), :title)]', array(':title' => 'Highlighted'));
$this->assertTrue(!empty($elements), 'Block demo regions are shown.');
}
@ -134,7 +134,7 @@ class BlockUiTest extends WebTestBase {
$arguments = array(
':ul_class' => 'block-list',
':li_class' => 'test-block-instantiation',
':href' => 'admin/structure/block/add/test_block_instantiation/stark',
':href' => 'admin/structure/block/add/test_block_instantiation/classy',
':text' => 'Display message',
);
@ -158,7 +158,7 @@ class BlockUiTest extends WebTestBase {
$arguments = array(
':ul_class' => 'block-list',
':li_class' => 'test-context-aware',
':href' => 'admin/structure/block/add/test_context_aware/stark',
':href' => 'admin/structure/block/add/test_context_aware/classy',
':text' => 'Test context-aware block',
);
@ -173,7 +173,7 @@ class BlockUiTest extends WebTestBase {
* Tests that the BlockForm populates machine name correctly.
*/
public function testMachineNameSuggestion() {
$url = 'admin/structure/block/add/test_block_instantiation/stark';
$url = 'admin/structure/block/add/test_block_instantiation/classy';
$this->drupalGet($url);
$this->assertFieldByName('id', 'displaymessage', 'Block form uses raw machine name suggestion when no instance already exists.');
$this->drupalPostForm($url, array(), 'Save block');
@ -195,16 +195,16 @@ class BlockUiTest extends WebTestBase {
// Select the 'Powered by Drupal' block to be placed.
$block = array();
$block['id'] = strtolower($this->randomMachineName());
$block['theme'] = 'stark';
$block['theme'] = 'classy';
$block['region'] = 'content';
// After adding a block, it will indicate which block was just added.
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
$this->assertUrl('admin/structure/block/list/stark?block-placement=' . drupal_html_class($block['id']));
$this->assertUrl('admin/structure/block/list/classy?block-placement=' . drupal_html_class($block['id']));
// Resaving the block page will remove the block indicator.
$this->drupalPostForm(NULL, array(), t('Save blocks'));
$this->assertUrl('admin/structure/block/list/stark');
$this->assertUrl('admin/structure/block/list/classy');
}
}

View File

@ -66,7 +66,7 @@ class DisplayBlockTest extends ViewTestBase {
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1',
':href' => \Drupal::Url('block.admin_add', array(
'plugin_id' => 'views_block:' . $edit['id'] . '-block_1',
'theme' => 'stark',
'theme' => 'classy',
)),
':text' => $edit['label'],
);
@ -105,7 +105,7 @@ class DisplayBlockTest extends ViewTestBase {
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2',
':href' => \Drupal::Url('block.admin_add', array(
'plugin_id' => 'views_block:' . $edit['id'] . '-block_2',
'theme' => 'stark',
'theme' => 'classy',
)),
':text' => $edit['label'],
);
@ -117,7 +117,7 @@ class DisplayBlockTest extends ViewTestBase {
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-3',
':href' => \Drupal::Url('block.admin_add', array(
'plugin_id' => 'views_block:' . $edit['id'] . '-block_3',
'theme' => 'stark',
'theme' => 'classy',
)),
':text' => $edit['label'],
);

View File

@ -13,5 +13,5 @@ dependencies:
module:
- block_test
theme:
- stark
- classy
visibility: { }

View File

@ -144,7 +144,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
// Install all themes.
\Drupal::service('theme_handler')->install(array('bartik', 'seven'));
$themes = array('bartik', 'seven', 'stark');
$themes = array('bartik', 'seven', 'classy');
$theme_settings = $this->container->get('config.factory')->get('system.theme');
foreach ($themes as $default_theme) {
// Change the default theme.
@ -152,7 +152,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
\Drupal::service('router.builder')->rebuild();
// For each installed theme, go to its block page and test the redirects.
$themes = array('bartik', 'stark', 'seven');
$themes = array('bartik', 'classy', 'seven');
foreach ($themes as $theme) {
// Test that adding a block from the 'place blocks' form sends you to the
// block configure form.

View File

@ -6,7 +6,7 @@ dependencies:
theme:
- stark
id: foobargorilla
theme: stark
theme: classy
region: content
weight: null
provider: null

View File

@ -48,7 +48,7 @@ class MenuCacheTagsTest extends PageCacheTagsTestBase {
// Verify a cache hit, but also the presence of the correct cache tags.
$expected_tags = array(
'theme:stark',
'theme:classy',
'theme_global_settings',
'rendered',
'block_view',
@ -106,7 +106,7 @@ class MenuCacheTagsTest extends PageCacheTagsTestBase {
$this->verifyPageCache($path, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($path, 'HIT', array('rendered', 'theme:stark', 'theme_global_settings'));
$this->verifyPageCache($path, 'HIT', array('rendered', 'theme:classy', 'theme_global_settings'));
}
}

View File

@ -36,7 +36,7 @@ class SearchBlockTest extends SearchTestBase {
// Test availability of the search block in the admin "Place blocks" list.
$this->drupalGet('admin/structure/block');
$this->assertLinkByHref('/admin/structure/block/add/search_form_block/stark', 0,
$this->assertLinkByHref('/admin/structure/block/add/search_form_block/classy', 0,
'Did not find the search block in block candidate list.');
$block = $this->drupalPlaceBlock('search_form_block');

View File

@ -203,7 +203,7 @@ abstract class KernelTestBase extends TestBase {
$this->enableModules($modules);
}
// In order to use theme functions default theme config needs to exist.
\Drupal::config('system.theme')->set('default', 'stark');
\Drupal::config('system.theme')->set('default', 'classy');
// Tests based on this class are entitled to use Drupal's File and
// StreamWrapper APIs.

View File

@ -65,7 +65,7 @@ class PageCacheTest extends WebTestBase {
'pre_render',
'rendered',
'system_test_cache_tags_page',
'theme:stark',
'theme:classy',
'theme_global_settings',
);
$this->assertIdentical($cache_entry->tags, $expected_tags);

View File

@ -283,7 +283,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$nonempty_entity_listing_path = 'entity_test/list_labels_alphabetically/' . $entity_type;
$render_cache_tags = array('rendered');
$theme_cache_tags = array('theme:stark', 'theme_global_settings');
$theme_cache_tags = array('theme:classy', 'theme_global_settings');
$view_cache_tag = array();
if ($this->entity->getEntityType()->hasHandlerClass('view_builder')) {
@ -327,7 +327,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$tags = Cache::mergeTags($render_cache_tags, $theme_cache_tags, $referencing_entity_cache_tags);
$this->verifyPageCache($referencing_entity_path, 'HIT', $tags);
// Also verify the existence of an entity render cache entry.
$cid = 'entity_view:entity_test:' . $this->referencing_entity->id() . ':full:stark:r.anonymous:' . date_default_timezone_get();
$cid = 'entity_view:entity_test:' . $this->referencing_entity->id() . ':full:classy:r.anonymous:' . date_default_timezone_get();
$tags = Cache::mergeTags($render_cache_tags, $referencing_entity_cache_tags);
$this->verifyRenderCache($cid, $tags);
@ -337,7 +337,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$tags = Cache::mergeTags($render_cache_tags, $theme_cache_tags, $non_referencing_entity_cache_tags);
$this->verifyPageCache($non_referencing_entity_path, 'HIT', $tags);
// Also verify the existence of an entity render cache entry.
$cid = 'entity_view:entity_test:' . $this->non_referencing_entity->id() . ':full:stark:r.anonymous:' . date_default_timezone_get();
$cid = 'entity_view:entity_test:' . $this->non_referencing_entity->id() . ':full:classy:r.anonymous:' . date_default_timezone_get();
$tags = Cache::mergeTags($render_cache_tags, $non_referencing_entity_cache_tags);
$this->verifyRenderCache($cid, $tags);

View File

@ -44,7 +44,7 @@ abstract class EntityWithUriCacheTagsTestBase extends EntityCacheTagsTestBase {
// Also verify the existence of an entity render cache entry, if this entity
// type supports render caching.
if (\Drupal::entityManager()->getDefinition($entity_type)->isRenderCacheable()) {
$cid = 'entity_view:' . $entity_type . ':' . $this->entity->id() . ':' . $view_mode . ':stark:r.anonymous:' . date_default_timezone_get();
$cid = 'entity_view:' . $entity_type . ':' . $this->entity->id() . ':' . $view_mode . ':classy:r.anonymous:' . date_default_timezone_get();
$cache_entry = \Drupal::cache('render')->get($cid);
$expected_cache_tags = Cache::mergeTags($cache_tag, $view_cache_tag, $this->getAdditionalCacheTagsForEntity($this->entity), array($render_cache_tag));
$this->verifyRenderCache($cid, $expected_cache_tags);

View File

@ -65,7 +65,7 @@ class InstallerTranslationTest extends InstallerTestBase {
$edit = array('preprocess_css' => FALSE);
$this->drupalPostForm('admin/config/development/performance', $edit, t('Save configuration'));
$this->drupalGet('<front>');
$this->assertRaw('stark/css/layout.css');
$this->assertRaw('classy/css/layout.css');
}
}

View File

@ -247,7 +247,6 @@ class MenuRouterTest extends WebTestBase {
->set('default', $this->default_theme)
->set('admin', $this->admin_theme)
->save();
$theme_handler->uninstall(array('stark'));
$this->doTestThemeCallbackMaintenanceMode();

View File

@ -48,7 +48,7 @@ class ThemeTest extends WebTestBase {
// Specify a filesystem path to be used for the logo.
$file = current($this->drupalGetTestFiles('image'));
$file_relative = strtr($file->uri, array('public:/' => PublicStream::basePath()));
$default_theme_path = 'core/themes/stark';
$default_theme_path = 'core/themes/classy';
$supported_paths = array(
// Raw stream wrapper URI.
@ -192,7 +192,7 @@ class ThemeTest extends WebTestBase {
$this->assertRaw('core/themes/seven', 'Administration theme used on an administration page.');
$this->drupalGet('node/' . $this->node->id());
$this->assertRaw('core/themes/stark', 'Site default theme used on node page.');
$this->assertRaw('core/themes/classy', 'Site default theme used on node page.');
$this->drupalGet('node/add');
$this->assertRaw('core/themes/seven', 'Administration theme used on the add content page.');
@ -218,7 +218,7 @@ class ThemeTest extends WebTestBase {
$this->drupalLogin($this->admin_user);
$this->drupalGet('node/add');
$this->assertRaw('core/themes/stark', 'Site default theme used on the add content page.');
$this->assertRaw('core/themes/classy', 'Site default theme used on the add content page.');
// Reset to the default theme settings.
$edit = array(
@ -228,10 +228,10 @@ class ThemeTest extends WebTestBase {
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
$this->drupalGet('admin');
$this->assertRaw('core/themes/stark', 'Site default theme used on administration page.');
$this->assertRaw('core/themes/classy', 'Site default theme used on administration page.');
$this->drupalGet('node/add');
$this->assertRaw('core/themes/stark', 'Site default theme used on the add content page.');
$this->assertRaw('core/themes/classy', 'Site default theme used on the add content page.');
}
/**
@ -249,10 +249,10 @@ class ThemeTest extends WebTestBase {
$this->assertText('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page is the default theme.');
// Switch back to Stark and test again to test that the menu cache is cleared.
$this->drupalGet('admin/appearance');
// Stark is the second 'Set as default' link.
$this->clickLink(t('Set as default'), 1);
// Classy is the first 'Set as default' link.
$this->clickLink(t('Set as default'), 0);
$this->drupalGet('admin/structure/block');
$this->assertText('Stark(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
$this->assertText('Classy(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
}
/**

View File

@ -33,6 +33,6 @@ class ThemeEarlyInitializationTest extends WebTestBase {
$this->assertRaw('Themed output generated in a KernelEvents::REQUEST listener');
// Verify that the default theme's CSS still appears even though the theme
// system was initialized early.
$this->assertRaw('stark/css/layout.css');
$this->assertRaw('classy/css/layout.css');
}
}

View File

@ -26,7 +26,7 @@ class HighPriorityThemeNegotiator implements ThemeNegotiatorInterface {
* {@inheritdoc}
*/
public function determineActiveTheme(RouteMatchInterface $route_match) {
return 'stark';
return 'classy';
}
}

View File

@ -12,6 +12,7 @@ name: 'Test theme'
type: theme
description: 'Theme for testing the theme system'
version: VERSION
base theme: classy
core: 8.x
stylesheets-remove:
- system.module.css

View File

@ -49,7 +49,7 @@ class TourCacheTagsTest extends PageCacheTagsTestBase {
// Verify a cache hit, but also the presence of the correct cache tags.
$expected_tags = array(
'theme:stark',
'theme:classy',
'theme_global_settings',
'tour:tour-test',
'rendered',
@ -70,7 +70,7 @@ class TourCacheTagsTest extends PageCacheTagsTestBase {
$this->verifyPageCache($path, 'MISS');
// Verify a cache hit.
$this->verifyPageCache($path, 'HIT', array('rendered', 'theme:stark', 'theme_global_settings'));
$this->verifyPageCache($path, 'HIT', array('rendered', 'theme:classy', 'theme_global_settings'));
}
}

View File

@ -0,0 +1,2 @@
# @todo: Remove this file in https://www.drupal.org/node/2352949
default: classy

View File

@ -4,3 +4,6 @@ description: 'Minimal profile for running tests. Includes absolutely required mo
version: VERSION
core: 8.x
hidden: true
# @todo: Remove this in https://www.drupal.org/node/2352949
themes:
- classy

View File

@ -4,3 +4,7 @@ description: 'A base theme with sensible default CSS classes added. Learn how to
package: Core
version: VERSION
core: 8.x
stylesheets:
all:
- css/layout.css

View File

@ -0,0 +1,6 @@
/**
* @file
* Classy layout file. Do NOT delete. Needed for testing.
*
* @see \Drupal\system\Tests\Installer\InstallerTranslationTest::testInstaller()
*/

BIN
core/themes/classy/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB