diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php index 262fd0c..cc703cd 100644 --- a/core/lib/Drupal/Core/Block/BlockBase.php +++ b/core/lib/Drupal/Core/Block/BlockBase.php @@ -108,6 +108,7 @@ public function defaultConfiguration() { */ public function setConfigurationValue($key, $value) { $this->configuration[$key] = $value; + return $this; } /** diff --git a/core/lib/Drupal/Core/Block/BlockPluginInterface.php b/core/lib/Drupal/Core/Block/BlockPluginInterface.php index 0a58b33..0440989 100644 --- a/core/lib/Drupal/Core/Block/BlockPluginInterface.php +++ b/core/lib/Drupal/Core/Block/BlockPluginInterface.php @@ -78,6 +78,8 @@ public function build(); * @param mixed $value * The value to set for the provided key. * + * @return $this + * * @todo This doesn't belong here. Move this into a new base class in * http://drupal.org/node/1764380. * @todo This does not set a value in \Drupal::config(), so the name is confusing. diff --git a/core/modules/block/src/Tests/BlockSystemBrandingTest.php b/core/modules/block/src/Tests/BlockSystemBrandingTest.php index 57ebc85..badfc42 100644 --- a/core/modules/block/src/Tests/BlockSystemBrandingTest.php +++ b/core/modules/block/src/Tests/BlockSystemBrandingTest.php @@ -7,6 +7,8 @@ namespace Drupal\block\Tests; +use Drupal\block\Entity\Block; + /** * Tests branding block display. * @@ -54,9 +56,11 @@ public function testSystemBrandingSettings() { $this->assertCacheTag('config:system.site'); // Turn just the logo off. - $this->config('block.block.site-branding') - ->set('settings.use_site_logo', 0) - ->save(); + /** @var \Drupal\block\BlockInterface $block */ + $block = Block::load('site-branding'); + $block->getPlugin()->setConfigurationValue('use_site_logo', FALSE); + $block->save(); + $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); @@ -68,10 +72,11 @@ public function testSystemBrandingSettings() { $this->assertCacheTag('config:system.site'); // Turn just the site name off. - $this->config('block.block.site-branding') - ->set('settings.use_site_logo', 1) - ->set('settings.use_site_name', 0) - ->save(); + $block->getPlugin() + ->setConfigurationValue('use_site_logo', TRUE) + ->setConfigurationValue('use_site_name', FALSE); + $block->save(); + $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); @@ -83,10 +88,11 @@ public function testSystemBrandingSettings() { $this->assertCacheTag('config:system.site'); // Turn just the site slogan off. - $this->config('block.block.site-branding') - ->set('settings.use_site_name', 1) - ->set('settings.use_site_slogan', 0) - ->save(); + $block->getPlugin() + ->setConfigurationValue('use_site_name', TRUE) + ->setConfigurationValue('use_site_slogan', FALSE); + $block->save(); + $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); @@ -98,10 +104,11 @@ public function testSystemBrandingSettings() { $this->assertCacheTag('config:system.site'); // Turn the site name and the site slogan off. - $this->config('block.block.site-branding') - ->set('settings.use_site_name', 0) - ->set('settings.use_site_slogan', 0) - ->save(); + $block->getPlugin() + ->setConfigurationValue('use_site_name', FALSE) + ->setConfigurationValue('use_site_slogan', FALSE); + $block->save(); + $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath);