function ConditionPluginCollectionTest::testGetConfiguration
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Condition/ConditionPluginCollectionTest.php \Drupal\KernelTests\Core\Condition\ConditionPluginCollectionTest::testGetConfiguration()
@covers ::getConfiguration
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Condition/ ConditionPluginCollectionTest.php, line 29
Class
- ConditionPluginCollectionTest
- @coversDefaultClass \Drupal\Core\Condition\ConditionPluginCollection
Namespace
Drupal\KernelTests\Core\ConditionCode
public function testGetConfiguration() : void {
// Include a condition that has custom configuration and a type mismatch on
// 'negate' by using 0 instead of FALSE.
$configuration['request_path'] = [
'id' => 'request_path',
'negate' => 0,
'context_mapping' => [],
'pages' => '/user/*',
];
// Include a condition that matches default values but with a type mismatch
// on 'negate' by using 0 instead of FALSE. This condition will be removed,
// because condition configurations that match default values with "=="
// comparison are not saved or exported.
$configuration['user_role'] = [
'id' => 'user_role',
'negate' => '0',
'context_mapping' => [],
'roles' => [],
];
$collection = new ConditionPluginCollection(\Drupal::service('plugin.manager.condition'), $configuration);
$expected['request_path'] = [
'id' => 'request_path',
'negate' => 0,
'context_mapping' => [],
'pages' => '/user/*',
];
// NB: The 'user_role' property should not exist in expected set.
$this->assertSame($expected, $collection->getConfiguration());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.