You are here

public function DerivativeDiscoveryDecoratorTest::testNonExistentDerivativeFetcher in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest::testNonExistentDerivativeFetcher()

Tests the getDerivativeFetcher method with a non-existent class.

@expectedException \Drupal\Component\Plugin\Exception\InvalidDeriverException @expectedExceptionMessage Plugin (non_existent_discovery) deriver "\Drupal\system\Tests\Plugin\NonExistentDeriver" does not exist.

See also

\Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\

File

core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php, line 98
Contains \Drupal\Tests\Core\Plugin\Discovery\DerivativeDiscoveryDecoratorTest.

Class

DerivativeDiscoveryDecoratorTest
Unit tests for the derivative discovery decorator.

Namespace

Drupal\Tests\Core\Plugin\Discovery

Code

public function testNonExistentDerivativeFetcher() {
  $definitions = array();

  // Do this with a class that doesn't exist.
  $definitions['non_existent_discovery'] = array(
    'id' => 'non_existent_discovery',
    'deriver' => '\\Drupal\\system\\Tests\\Plugin\\NonExistentDeriver',
  );
  $this->discoveryMain
    ->expects($this
    ->any())
    ->method('getDefinitions')
    ->will($this
    ->returnValue($definitions));
  $discovery = new DerivativeDiscoveryDecorator($this->discoveryMain);
  $discovery
    ->getDefinitions();
}