public function TemplateSetWithYamlTest::testTemplateByYaml in Block Style Plugins 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/TemplateSetWithYamlTest.php \Drupal\Tests\block_style_plugins\Functional\TemplateSetWithYamlTest::testTemplateByYaml()
Test template set by Yaml.
Test that the "Powered by Drupal" block uses the template set via YAML.
File
- tests/
src/ Functional/ TemplateSetWithYamlTest.php, line 58
Class
- TemplateSetWithYamlTest
- Test a Yaml only configuration.
Namespace
Drupal\Tests\block_style_plugins\FunctionalCode
public function testTemplateByYaml() {
$assert = $this
->assertSession();
// Go to the block instance configuration page.
$this
->drupalGet('admin/structure/block/manage/templatetest');
// Check that the style options are available.
$assert
->responseContains('Template Title');
$this
->submitForm([
'third_party_settings[block_style_plugins][template_set_with_yaml][test_field]' => 'custom-class',
], 'Save block');
// Go to the home page.
$this
->drupalGet('<front>');
// Assert that the block was placed and has the template applied.
$assert
->responseContains('This is a custom template');
}