diff --git a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php index 147e64a..bf01f41 100644 --- a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php +++ b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php @@ -74,23 +74,27 @@ public function setUpDisplayVariant($configuration = array(), $definition = arra public function providerBuild() { $blocks_config = array( 'block1' => array( - // region, is main content block, is messages block - 'top', FALSE, FALSE, + // region, is main content block, is messages block, is title block + 'top', FALSE, FALSE, FALSE, ), // Test multiple blocks in the same region. 'block2' => array( - 'bottom', FALSE, FALSE, + 'bottom', FALSE, FALSE, FALSE, ), 'block3' => array( - 'bottom', FALSE, FALSE, + 'bottom', FALSE, FALSE, FALSE, ), // Test a block implementing MainContentBlockPluginInterface. 'block4' => array( - 'center', TRUE, FALSE, + 'center', TRUE, FALSE, FALSE, ), // Test a block implementing MessagesBlockPluginInterface. 'block5' => array( - 'center', FALSE, TRUE, + 'center', FALSE, TRUE, FALSE, + ), + // Test a block implementing TitleBlockPluginInterface. + 'block7' => array( + 'center', FALSE, FALSE, TRUE, ), ); @@ -146,13 +150,19 @@ public function providerBuild() { 'block3' => [], '#sorted' => TRUE, ], - // The messages are rendered via the fallback in case there is no block - // rendering the main content. + // The messages and title are rendered via the fallback in case there is + // no block rendering the main content. 'content' => [ 'messages' => [ '#weight' => -1000, '#type' => 'status_messages', ], + 'page_title' => [ + '#markup' => 'Hi llamas!', + '#prefix' => '

', + '#suffix' => '

', + '#weight' => -900, + ], ], ], ]; @@ -176,7 +186,7 @@ public function providerBuild() { 'block3' => [], '#sorted' => TRUE, ], - // The main content & messages are rendered via the fallback in case + // The main content, messages and title are rendered via the fallback in case // there are no blocks rendering them. 'content' => [ 'system_main' => ['#markup' => 'Hello kittens!'], @@ -184,6 +194,12 @@ public function providerBuild() { '#weight' => -1000, '#type' => 'status_messages', ], + 'page_title' => [ + '#markup' => 'Hi cats!', + '#prefix' => '

', + '#suffix' => '

', + '#weight' => -900, + ], ], ], ]; @@ -205,6 +221,7 @@ public function testBuild(array $blocks_config, $visible_block_count, array $exp $block_plugin = $this->getMock('Drupal\Core\Block\BlockPluginInterface'); $main_content_block_plugin = $this->getMock('Drupal\Core\Block\MainContentBlockPluginInterface'); $messages_block_plugin = $this->getMock('Drupal\Core\Block\MessagesBlockPluginInterface'); + $title_block_plugin = $this->getMock('Drupal\Core\Block\TitleBlockPluginInterface'); foreach ($blocks_config as $block_id => $block_config) { $block = $this->getMock('Drupal\block\BlockInterface'); $block->expects($this->any()) @@ -212,7 +229,7 @@ public function testBuild(array $blocks_config, $visible_block_count, array $exp ->willReturn([]); $block->expects($this->atLeastOnce()) ->method('getPlugin') - ->willReturn($block_config[1] ? $main_content_block_plugin : ($block_config[2] ? $messages_block_plugin : $block_plugin)); + ->willReturn($block_config[1] ? $main_content_block_plugin : ($block_config[2] ? $messages_block_plugin : ($block_config[3] ? $title_block_plugin : $block_plugin))); $blocks[$block_config[0]][$block_id] = $block; } $this->blockViewBuilder->expects($this->exactly($visible_block_count)) @@ -254,6 +271,12 @@ public function testBuildWithoutMainContent() { '#weight' => -1000, '#type' => 'status_messages', ], + 'page_title' => [ + '#markup' => '', + '#prefix' => '

', + '#suffix' => '

', + '#weight' => -900, + ], ], ]; $this->assertSame($expected, $display_variant->build()); diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php index a5d6d09..213b081 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php @@ -52,7 +52,7 @@ * * @var string[] */ - protected $defaultCacheContexts = ['languages:language_interface', 'theme', 'url.query_args:_wrapper_format', 'user.permissions']; + protected $defaultCacheContexts = ['languages:language_interface', 'theme', 'url.query_args:_wrapper_format', 'user.permissions', 'route']; /** * Tests the basic translation UI. diff --git a/core/modules/contextual/src/Tests/ContextualDynamicContextTest.php b/core/modules/contextual/src/Tests/ContextualDynamicContextTest.php index 38955ab..6ed297e 100644 --- a/core/modules/contextual/src/Tests/ContextualDynamicContextTest.php +++ b/core/modules/contextual/src/Tests/ContextualDynamicContextTest.php @@ -47,7 +47,7 @@ class ContextualDynamicContextTest extends WebTestBase { * * @var array */ - public static $modules = array('contextual', 'node', 'views', 'views_ui', 'language', 'menu_test'); + public static $modules = array('block', 'contextual', 'node', 'views', 'views_ui', 'language', 'menu_test'); protected function setUp() { parent::setUp(); @@ -55,6 +55,8 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); + $this->drupalPlaceBlock('system_page_title_block'); + ConfigurableLanguage::createFromLangcode('it')->save(); $this->rebuildContainer(); diff --git a/core/modules/help/src/Tests/HelpTest.php b/core/modules/help/src/Tests/HelpTest.php index 2a423ba..792eb9a 100644 --- a/core/modules/help/src/Tests/HelpTest.php +++ b/core/modules/help/src/Tests/HelpTest.php @@ -24,7 +24,7 @@ class HelpTest extends WebTestBase { * * @var array. */ - public static $modules = array('help_test'); + public static $modules = array('block', 'help_test'); /** * Use the Standard profile to test help implementations of many core modules. @@ -46,6 +46,8 @@ protected function setUp() { $this->getModuleList(); + $this->drupalPlaceBlock('system_page_title_block'); + // Create users. $this->adminUser = $this->drupalCreateUser(array('access administration pages', 'view the administration theme', 'administer permissions')); $this->anyUser = $this->drupalCreateUser(array()); diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php index 3f7994b..9db2318 100644 --- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php @@ -58,6 +58,8 @@ class LanguageUILanguageNegotiationTest extends WebTestBase { protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_page_title_block'); + $admin_user = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages', 'administer blocks')); $this->drupalLogin($admin_user); } diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php index 84f315b..0a5f0b4 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -26,6 +26,16 @@ class ShortcutLinksTest extends ShortcutTestBase { */ public static $modules = array('router_test', 'views', 'block'); + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->drupalPlaceBlock('system_page_title_block'); + } + /** * Tests that creating a shortcut works properly. */ diff --git a/core/modules/system/src/Tests/Render/DisplayVariantTest.php b/core/modules/system/src/Tests/Render/DisplayVariantTest.php index 432aacf..3fcc1b0 100644 --- a/core/modules/system/src/Tests/Render/DisplayVariantTest.php +++ b/core/modules/system/src/Tests/Render/DisplayVariantTest.php @@ -21,7 +21,16 @@ class DisplayVariantTest extends WebTestBase { * * @var array */ - public static $modules = array('display_variant_test'); + public static $modules = array('block', 'display_variant_test'); + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->drupalPlaceBlock('system_page_title_block'); + } /** * Tests selecting the variant and passing configuration. diff --git a/core/modules/system/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php index 56fa556..44bd578 100644 --- a/core/modules/system/src/Tests/System/PageTitleTest.php +++ b/core/modules/system/src/Tests/System/PageTitleTest.php @@ -23,7 +23,7 @@ class PageTitleTest extends WebTestBase { * * @var array */ - public static $modules = array('node', 'test_page_test', 'form_test'); + public static $modules = array('block', 'node', 'test_page_test', 'form_test'); protected $contentUser; protected $savedTitle; @@ -36,6 +36,8 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); + $this->drupalPlaceBlock('system_page_title_block'); + $this->contentUser = $this->drupalCreateUser(array('create page content', 'access content', 'administer themes', 'administer site configuration', 'link to any page')); $this->drupalLogin($this->contentUser); } diff --git a/core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php b/core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php index 2057272..c952052 100644 --- a/core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php +++ b/core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php @@ -28,6 +28,13 @@ class TestDisplayVariant extends VariantBase implements PageVariantInterface { protected $mainContent = []; /** + * The page title. + * + * @var string + */ + protected $title = ''; + + /** * {@inheritdoc} */ public function setMainContent(array $main_content) { @@ -38,6 +45,14 @@ public function setMainContent(array $main_content) { /** * {@inheritdoc} */ + public function setTitle($title) { + $this->title = $title; + return $this; + } + + /** + * {@inheritdoc} + */ public function build() { $config = $this->getConfiguration(); if (empty($config['required_configuration'])) { diff --git a/core/modules/user/src/Tests/Views/RolesRidArgumentTest.php b/core/modules/user/src/Tests/Views/RolesRidArgumentTest.php index 642a691..c39d630 100644 --- a/core/modules/user/src/Tests/Views/RolesRidArgumentTest.php +++ b/core/modules/user/src/Tests/Views/RolesRidArgumentTest.php @@ -23,6 +23,22 @@ class RolesRidArgumentTest extends UserTestBase { public static $testViews = array('test_user_roles_rid'); /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('block'); + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->drupalPlaceBlock('system_page_title_block'); + } + + /** * Tests the generated title of a user: roles argument. */ public function testArgumentTitle() { diff --git a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php index e9052b4..6f69411 100644 --- a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php +++ b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php @@ -34,6 +34,8 @@ protected function setUp() { $this->enableViewsTestModule(); + $this->drupalPlaceBlock('system_page_title_block'); + $admin_user = $this->drupalCreateUser(array('administer site configuration')); $this->drupalLogin($admin_user); } diff --git a/core/modules/views_ui/src/Tests/DisplayTest.php b/core/modules/views_ui/src/Tests/DisplayTest.php index 20667de..f8a1f95 100644 --- a/core/modules/views_ui/src/Tests/DisplayTest.php +++ b/core/modules/views_ui/src/Tests/DisplayTest.php @@ -35,6 +35,15 @@ class DisplayTest extends UITestBase { public static $modules = array('contextual'); /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->drupalPlaceBlock('system_page_title_block'); + } + + /** * Tests reordering of displays. */ public function testReorderDisplay() { diff --git a/core/modules/views_ui/src/Tests/HandlerTest.php b/core/modules/views_ui/src/Tests/HandlerTest.php index c53ddd7..e710454 100644 --- a/core/modules/views_ui/src/Tests/HandlerTest.php +++ b/core/modules/views_ui/src/Tests/HandlerTest.php @@ -26,6 +26,16 @@ class HandlerTest extends UITestBase { public static $testViews = array('test_view_empty', 'test_view_broken'); /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->drupalPlaceBlock('system_page_title_block'); + } + + + /** * Overrides \Drupal\views\Tests\ViewTestBase::schemaDefinition(). * * Adds a uid column to test the relationships.