public function BlockStyleBaseTest::testSetConfiguration in Block Style Plugins 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/Plugin/BlockStyleBaseTest.php \Drupal\Tests\block_style_plugins\Unit\Plugin\BlockStyleBaseTest::testSetConfiguration()
Tests the setConfiguration method.
See also
::setConfiguration()
File
- tests/
src/ Unit/ Plugin/ BlockStyleBaseTest.php, line 315
Class
- BlockStyleBaseTest
- @coversDefaultClass \Drupal\block_style_plugins\Plugin\BlockStyleBase @group block_style_plugins
Namespace
Drupal\Tests\block_style_plugins\Unit\PluginCode
public function testSetConfiguration() {
$expected = [
'sample_class' => '',
'sample_checkbox' => FALSE,
'new_key' => 'new_val',
];
$new_styles = [
'new_key' => 'new_val',
];
$this->plugin
->setConfiguration($new_styles);
$return = $this->plugin
->getConfiguration();
$this
->assertArrayEquals($expected, $return);
// Overwrite styles.
$expected = [
'sample_class' => 'class_name',
'sample_checkbox' => TRUE,
];
$this->plugin
->setConfiguration($expected);
$return = $this->plugin
->getConfiguration();
$this
->assertArrayEquals($expected, $return);
}