public function DerivativeDiscoveryDecoratorTest::testGetDeriverClassWithInvalidClassedDefinitions in Drupal 8
@covers ::getDeriverClass
File
- core/
tests/ Drupal/ Tests/ Core/ Plugin/ Discovery/ DerivativeDiscoveryDecoratorTest.php, line 116
Class
- DerivativeDiscoveryDecoratorTest
- Unit tests for the derivative discovery decorator.
Namespace
Drupal\Tests\Core\Plugin\DiscoveryCode
public function testGetDeriverClassWithInvalidClassedDefinitions() {
$definition = $this
->prophesize(DerivablePluginDefinitionInterface::class);
$definition
->id()
->willReturn('non_existent_discovery');
$definition
->getDeriver()
->willReturn('\\Drupal\\system\\Tests\\Plugin\\NonExistentDeriver');
$definitions['non_existent_discovery'] = $definition
->reveal();
$this->discoveryMain
->expects($this
->any())
->method('getDefinitions')
->willReturn($definitions);
$discovery = new DerivativeDiscoveryDecorator($this->discoveryMain);
$this
->expectException(InvalidDeriverException::class);
$this
->expectExceptionMessage('Plugin (non_existent_discovery) deriver "\\Drupal\\system\\Tests\\Plugin\\NonExistentDeriver" does not exist.');
$discovery
->getDefinitions();
}