public function TwigExtensionTest::testRecursiveMergeFilter in Components! 8.2
Same name and namespace in other branches
- 3.x tests/src/Kernel/TwigExtensionTest.php \Drupal\Tests\components\Kernel\TwigExtensionTest::testRecursiveMergeFilter()
Ensures the Twig "recursive_merge" filter works inside a Drupal instance.
@covers ::recursiveMergeFilter
@dataProvider providerTestRecursiveMergeFilter
File
- tests/
src/ Kernel/ TwigExtensionTest.php, line 60
Class
- TwigExtensionTest
- @coversDefaultClass \Drupal\components\Template\TwigExtension @group components
Namespace
Drupal\Tests\components\KernelCode
public function testRecursiveMergeFilter(string $theme_hook, string $expected) {
try {
$element = [
'#theme' => $theme_hook,
'list' => [
'#theme' => 'item_list',
'#items' => [
[
'#type' => 'container',
'#attributes' => [
'id' => 'the_element_id',
'class' => [
'original-container-class',
],
],
],
],
],
];
$result = $this
->render($element);
} catch (\Exception $e) {
$this
->fail('No Exception expected; "' . $e
->getMessage() . '" thrown during: ' . $this
->getName());
}
$this
->assertStringContainsString($expected, $result);
}