function ComponentRenderTest::checkIncludeDefaultContent
Same name in this branch
- 10 core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderTest::checkIncludeDefaultContent()
Same name in other branches
- 11.x core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php \Drupal\Tests\sdc\Kernel\ComponentRenderTest::checkIncludeDefaultContent()
- 11.x core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php \Drupal\KernelTests\Components\ComponentRenderTest::checkIncludeDefaultContent()
Check using a component with an include and default context.
1 call to ComponentRenderTest::checkIncludeDefaultContent()
- ComponentRenderTest::testRender in core/
tests/ Drupal/ KernelTests/ Components/ ComponentRenderTest.php - Test that components render correctly.
File
-
core/
tests/ Drupal/ KernelTests/ Components/ ComponentRenderTest.php, line 54
Class
- ComponentRenderTest
- Tests the correct rendering of components.
Namespace
Drupal\KernelTests\ComponentsCode
protected function checkIncludeDefaultContent() : void {
$build = [
'#type' => 'inline_template',
'#template' => "{% embed('sdc_theme_test_base:my-card-no-schema') %}{% block card_body %}Foo bar{% endblock %}{% endembed %}",
];
$crawler = $this->renderComponentRenderArray($build);
$this->assertNotEmpty($crawler->filter('#sdc-wrapper [data-component-id="sdc_theme_test_base:my-card-no-schema"] .component--my-card-no-schema__body:contains("Foo bar")'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.