
| Current Path : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Plugin/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Plugin/DerivativeTest.php |
<?php
declare(strict_types=1);
namespace Drupal\KernelTests\Core\Plugin;
/**
* Tests that derivative plugins are correctly discovered.
*
* @group Plugin
*/
class DerivativeTest extends PluginTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['node', 'user'];
/**
* Tests getDefinitions() and getDefinition() with a derivativeDecorator.
*/
public function testDerivativeDecorator(): void {
// 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.');
}
}