function DiscoveryTestBase::assertDefinitionIdentical
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase::assertDefinitionIdentical()
- 10 core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php \Drupal\KernelTests\Core\Plugin\Discovery\DiscoveryTestBase::assertDefinitionIdentical()
- 11.x 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.
1 call to DiscoveryTestBase::assertDefinitionIdentical()
- DiscoveryTestBase::testDiscoveryInterface in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Discovery/ DiscoveryTestBase.php - Tests getDefinitions() and getDefinition().
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.