public function TwigExtensionFiltersTest::testRecursiveMergeFilter in Components! 8.2
Same name and namespace in other branches
- 3.x tests/src/Unit/TwigExtensionFiltersTest.php \Drupal\Tests\components\Unit\TwigExtensionFiltersTest::testRecursiveMergeFilter()
Tests the recursive_merge filter.
@covers ::recursiveMergeFilter
@dataProvider providerTestRecursiveMergeFilter
Parameters
array $element: The element to alter.
array $value: The value to set.
array $expected: The expected result.
File
- tests/
src/ Unit/ TwigExtensionFiltersTest.php, line 83
Class
- TwigExtensionFiltersTest
- @coversDefaultClass \Drupal\components\Template\TwigExtension @group components
Namespace
Drupal\Tests\components\UnitCode
public function testRecursiveMergeFilter(array $element, array $value, array $expected) {
$result = NULL;
try {
$result = TwigExtension::recursiveMergeFilter($element, $value);
} catch (\Exception $e) {
$this
->fail('No Exception expected; "' . $e
->getMessage() . '" thrown during: ' . $this
->getName());
}
$this
->assertEquals($expected, $result, $this
->getName());
$this
->assertEquals(array_replace_recursive($element, $value), $result, $this
->getName());
}