DerivativeTest.php in Drupal 9
File
core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Plugin;
class DerivativeTest extends PluginTestBase {
protected static $modules = [
'node',
'user',
];
public function testDerivativeDecorator() {
$this
->assertEquals($this->mockBlockExpectedDefinitions, $this->mockBlockManager
->getDefinitions());
foreach ($this->mockBlockExpectedDefinitions as $id => $definition) {
$this
->assertEquals($definition, $this->mockBlockManager
->getDefinition($id));
}
$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.');
}
}