class DerivativeTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php \Drupal\KernelTests\Core\Plugin\DerivativeTest
- 10 core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php \Drupal\KernelTests\Core\Plugin\DerivativeTest
- 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php \Drupal\KernelTests\Core\Plugin\DerivativeTest
Tests that derivative plugins are correctly discovered.
@group Plugin
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\Core\Plugin\PluginTestBase implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\KernelTests\Core\Plugin\DerivativeTest implements \Drupal\KernelTests\Core\Plugin\PluginTestBase
- class \Drupal\KernelTests\Core\Plugin\PluginTestBase implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of DerivativeTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ DerivativeTest.php, line 10
Namespace
Drupal\KernelTests\Core\PluginView source
class DerivativeTest extends PluginTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'user',
];
/**
* Tests getDefinitions() and getDefinition() with a derivativeDecorator.
*/
public function testDerivativeDecorator() {
// Ensure that getDefinitions() returns the expected definitions.
$this->assertEquals($this->mockBlockExpectedDefinitions, $this->mockBlockManager
->getDefinitions());
// Ensure that getDefinition() returns the expected definition.
foreach ($this->mockBlockExpectedDefinitions as $id => $definition) {
$this->assertEquals($definition, $this->mockBlockManager
->getDefinition($id));
}
// Ensure that NULL is returned as the definition of a non-existing base
// plugin, a non-existing derivative plugin, or a base plugin that may not
// be used without deriving.
$this->assertNull($this->mockBlockManager
->getDefinition('non_existing', FALSE), 'NULL returned as the definition of a non-existing base plugin.');
$this->assertNull($this->mockBlockManager
->getDefinition('menu:non_existing', FALSE), 'NULL returned as the definition of a non-existing derivative plugin.');
$this->assertNull($this->mockBlockManager
->getDefinition('menu', FALSE), 'NULL returned as the definition of a base plugin that may not be used without deriving.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.