function ComponentNegotiatorTest::testNegotiate
Same name in this branch
- 11.x core/modules/sdc/tests/src/Kernel/ComponentNegotiatorTest.php \Drupal\Tests\sdc\Kernel\ComponentNegotiatorTest::testNegotiate()
- 11.x core/tests/Drupal/Tests/Core/Theme/Component/ComponentNegotiatorTest.php \Drupal\Tests\Core\Theme\Component\ComponentNegotiatorTest::testNegotiate()
Same name in other branches
- 10 core/modules/sdc/tests/src/Kernel/ComponentNegotiatorTest.php \Drupal\Tests\sdc\Kernel\ComponentNegotiatorTest::testNegotiate()
- 10 core/tests/Drupal/Tests/Core/Theme/Component/ComponentNegotiatorTest.php \Drupal\Tests\Core\Theme\Component\ComponentNegotiatorTest::testNegotiate()
@covers ::negotiate
File
-
core/
tests/ Drupal/ KernelTests/ Components/ ComponentNegotiatorTest.php, line 35
Class
- ComponentNegotiatorTest
- Tests the component negotiator.
Namespace
Drupal\KernelTests\ComponentsCode
public function testNegotiate() : void {
$data = [
[
'sdc_test:my-banner',
NULL,
],
[
'sdc_theme_test:my-card',
'sdc_theme_test_enforce_schema:my-card',
],
[
'sdc_test:my-button',
'sdc_test_replacements:my-button',
],
[
'invalid:component',
NULL,
],
[
'invalid^component',
NULL,
],
[
'',
NULL,
],
];
array_walk($data, function ($test_input) {
[
$requested_id,
$expected_id,
] = $test_input;
$negotiated_id = $this->negotiator
->negotiate($requested_id, $this->manager
->getDefinitions());
$this->assertSame($expected_id, $negotiated_id);
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.