function DerivativeDiscoveryDecoratorTest::testGetDerivativeFetcher
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest::testGetDerivativeFetcher()
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest::testGetDerivativeFetcher()
- 11.x core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest::testGetDerivativeFetcher()
Tests the getDerivativeFetcher method.
See also
\Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher()
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ Discovery/ DerivativeDiscoveryDecoratorTest.php, line 42
Class
- DerivativeDiscoveryDecoratorTest
- Unit tests for the derivative discovery decorator.
Namespace
Drupal\Tests\Core\Plugin\DiscoveryCode
public function testGetDerivativeFetcher() : void {
$definitions = [];
$definitions['non_container_aware_discovery'] = [
'id' => 'non_container_aware_discovery',
'deriver' => '\\Drupal\\Tests\\Core\\Plugin\\Discovery\\TestDerivativeDiscovery',
];
$this->discoveryMain
->expects($this->any())
->method('getDefinitions')
->willReturn($definitions);
$discovery = new DerivativeDiscoveryDecorator($this->discoveryMain);
$definitions = $discovery->getDefinitions();
// Ensure that both test derivatives got added.
$this->assertCount(2, $definitions);
$this->assertEquals('non_container_aware_discovery', $definitions['non_container_aware_discovery:test_discovery_0']['id']);
$this->assertEquals('\\Drupal\\Tests\\Core\\Plugin\\Discovery\\TestDerivativeDiscovery', $definitions['non_container_aware_discovery:test_discovery_0']['deriver']);
$this->assertEquals('non_container_aware_discovery', $definitions['non_container_aware_discovery:test_discovery_1']['id']);
$this->assertEquals('\\Drupal\\Tests\\Core\\Plugin\\Discovery\\TestDerivativeDiscovery', $definitions['non_container_aware_discovery:test_discovery_1']['deriver']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.