function ComponentNegotiatorTest::testNegotiate
@covers ::negotiate
      
    
File
- 
              core/
tests/ Drupal/ Tests/ Core/ Theme/ Component/ ComponentNegotiatorTest.php, line 35  
Class
- ComponentNegotiatorTest
 - Tests the component negotiator.
 
Namespace
Drupal\Tests\Core\Theme\ComponentCode
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.