public function FormFieldsCreatedWithYamlTest::testPoweredByBlockCreatedByYaml in Block Style Plugins 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/FormFieldsCreatedWithYamlTest.php \Drupal\Tests\block_style_plugins\Functional\FormFieldsCreatedWithYamlTest::testPoweredByBlockCreatedByYaml()
Test styles created by Yaml.
Test that the "Powered by Drupal" block does include style options created by the yaml file.
File
- tests/
src/ Functional/ FormFieldsCreatedWithYaml.php, line 74
Class
- FormFieldsCreatedWithYamlTest
- Test a Yaml only configuration.
Namespace
Drupal\Tests\block_style_plugins\FunctionalCode
public function testPoweredByBlockCreatedByYaml() {
$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('Title Created by Yaml');
$assert
->fieldExists('third_party_settings[block_style_plugins][form_fields_created_with_yaml][test_field]');
$assert
->fieldValueEquals('third_party_settings[block_style_plugins][form_fields_created_with_yaml][test_field]', 'text goes here');
$assert
->responseContains('Choose a style');
$assert
->fieldExists('third_party_settings[block_style_plugins][form_fields_created_with_yaml][second_field]');
$this
->submitForm([
'third_party_settings[block_style_plugins][form_fields_created_with_yaml][test_field]' => 'custom-class',
'third_party_settings[block_style_plugins][form_fields_created_with_yaml][second_field]' => 'style-2',
], 'Save block');
// Go to the home page.
$this
->drupalGet('<front>');
// Assert that the block was placed and has the custom class.
$assert
->responseContains('id="block-poweredbytest"');
$assert
->responseContains('custom-class');
$assert
->responseContains('style-2');
// 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][form_fields_created_with_yaml][test_field]', 'custom-class');
$assert
->fieldValueEquals('third_party_settings[block_style_plugins][form_fields_created_with_yaml][second_field]', 'style-2');
}