diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php index 261c3ae6ddb7b1060d4d1acc1753d0e9a42f8fe6..cc8e974f046e2ba1a308c99c1274cc02344fbc39 100644 --- a/core/modules/block/src/Tests/BlockTest.php +++ b/core/modules/block/src/Tests/BlockTest.php @@ -32,6 +32,7 @@ function testBlockVisibility() { 'id' => strtolower($this->randomMachineName(8)), 'region' => 'sidebar_first', 'settings[label]' => $title, + 'settings[label_display]' => TRUE, ); // Set the block to be hidden on any user path, and to be shown only to // authenticated users. @@ -142,11 +143,12 @@ function testBlock() { $block = array(); $block['id'] = 'system_powered_by_block'; $block['settings[label]'] = $this->randomMachineName(8); + $block['settings[label_display]'] = TRUE; $block['theme'] = $this->config('system.theme')->get('default'); $block['region'] = 'header'; // Set block title to confirm that interface works and override any custom titles. - $this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], array('settings[label]' => $block['settings[label]'], 'id' => $block['id'], 'region' => $block['region']), t('Save block')); + $this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], array('settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']), t('Save block')); $this->assertText(t('The block configuration has been saved.'), 'Block title set.'); // Check to see if the block was created by checking its configuration. $instance = Block::load($block['id']); @@ -255,19 +257,19 @@ function testHideBlockTitle() { $this->assertText('The block configuration has been saved.', 'Block was saved'); $this->drupalGet('user'); - $this->assertText($title, 'Block title was displayed by default.'); + $this->assertNoText($title, 'Block title was not displayed by default.'); $edit = array( - 'settings[label_display]' => FALSE, + 'settings[label_display]' => TRUE, ); $this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, t('Save block')); $this->assertText('The block configuration has been saved.', 'Block was saved'); $this->drupalGet('admin/structure/block/manage/' . $id); - $this->assertNoFieldChecked('edit-settings-label-display', 'The display_block option has the correct default value on the configuration form.'); + $this->assertFieldChecked('edit-settings-label-display', 'The display_block option has the correct default value on the configuration form.'); $this->drupalGet('user'); - $this->assertNoText($title, 'Block title was not displayed when hidden.'); + $this->assertText($title, 'Block title was displayed when enabled.'); } /** diff --git a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php index 25ea051ef4e809000de6946e6607f93644e135e6..a84c3fc2a89db7938e7ff638564b6d8175fd430f 100644 --- a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php @@ -19,6 +19,13 @@ */ class SystemPoweredByBlock extends BlockBase { + /** + * {@inheritdoc} + */ + public function defaultConfiguration() { + return ['label_display' => FALSE]; + } + /** * {@inheritdoc} */