public function DropdownWithIncludeTest::testPoweredByBlockIncluded in Block Style Plugins 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/DropdownWithIncludeTest.php \Drupal\Tests\block_style_plugins\Functional\DropdownWithIncludeTest::testPoweredByBlockIncluded()
Test the the "Powered by Drupal" block does include style options.
File
- tests/
src/ Functional/ DropdownWithIncludeTest.php, line 76
Class
- DropdownWithIncludeTest
- Tests the DropdownWithInclude plugin.
Namespace
Drupal\Tests\block_style_plugins\FunctionalCode
public function testPoweredByBlockIncluded() {
$assert = $this
->assertSession();
// Go to the block instance configuration page.
$this
->drupalGet('admin/structure/block/manage/poweredbytest');
// Check that the style options are available.
$assert
->responseContains('Choose a style from the dropdown');
$assert
->fieldValueEquals('third_party_settings[block_style_plugins][dropdown_with_include][dropdown_class]', 'style-3');
// Submit the form.
$this
->submitForm([
'third_party_settings[block_style_plugins][dropdown_with_include][dropdown_class]' => 'style-1',
], 'Save block');
// Go to the home page.
$this
->drupalGet('<front>');
// Assert that the block was placed and has the custom class.
$assert
->responseContains('style-1');
// Go back to the block instance configuration page.
$this
->drupalGet('admin/structure/block/manage/poweredbytest');
// Check that the class is set in the style field.
$assert
->fieldValueEquals('third_party_settings[block_style_plugins][dropdown_with_include][dropdown_class]', 'style-1');
}