public function DerivativeDiscoveryDecoratorTest::testInvalidDerivativeFetcher in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest::testInvalidDerivativeFetcher()
Tests the getDerivativeFetcher method with an invalid class.
@expectedException \Drupal\Component\Plugin\Exception\InvalidDeriverException @expectedExceptionMessage Plugin (invalid_discovery) deriver "\Drupal\system\Tests\Plugin\DerivativeTest" must implement \Drupal\Component\Plugin\Derivative\DeriverInterface.
See also
\Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\
File
- core/
tests/ Drupal/ Tests/ Core/ Plugin/ Discovery/ DerivativeDiscoveryDecoratorTest.php, line 121 - Contains \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest.
Class
- DerivativeDiscoveryDecoratorTest
- Unit tests for the derivative discovery decorator.
Namespace
Drupal\Tests\Core\Plugin\DiscoveryCode
public function testInvalidDerivativeFetcher() {
$definitions = array();
// Do this with a class that doesn't implement the interface.
$definitions['invalid_discovery'] = array(
'id' => 'invalid_discovery',
'deriver' => '\\Drupal\\system\\Tests\\Plugin\\DerivativeTest',
);
$this->discoveryMain
->expects($this
->any())
->method('getDefinitions')
->will($this
->returnValue($definitions));
$discovery = new DerivativeDiscoveryDecorator($this->discoveryMain);
$discovery
->getDefinitions();
}