protected function DiscoveryTestBase::assertDefinitionIdentical in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase::assertDefinitionIdentical()
- 9 core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase::assertDefinitionIdentical()
Asserts a definition against an expected definition.
Converts any instances of \Drupal\Core\Annotation\Translation to a string.
Parameters
array $definition: The definition to test.
array $expected_definition: The expected definition to test against.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Discovery/ DiscoveryTestBase.php, line 70
Class
- DiscoveryTestBase
- Base class for plugin discovery tests.
Namespace
Drupal\KernelTests\Core\Plugin\DiscoveryCode
protected function assertDefinitionIdentical(array $definition, array $expected_definition) {
$func = function (&$item) {
if ($item instanceof TranslatableMarkup) {
$item = (string) $item;
}
};
array_walk_recursive($definition, $func);
array_walk_recursive($expected_definition, $func);
$this
->assertSame($expected_definition, $definition);
}