StaticDiscoveryTest.php in Drupal 10
File
core/tests/Drupal/KernelTests/Core/Plugin/Discovery/StaticDiscoveryTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Plugin\Discovery;
use Drupal\Component\Plugin\Discovery\StaticDiscovery;
class StaticDiscoveryTest extends DiscoveryTestBase {
protected function setUp() : void {
parent::setUp();
$this->expectedDefinitions = [
'apple' => [
'label' => 'Apple',
'color' => 'green',
],
'cherry' => [
'label' => 'Cherry',
'color' => 'red',
],
'orange' => [
'label' => 'Orange',
'color' => 'orange',
],
];
$discovery = new StaticDiscovery();
foreach ($this->expectedDefinitions as $plugin_id => $definition) {
$discovery
->setDefinition($plugin_id, $definition);
}
$this->discovery = clone $discovery;
foreach ($this->expectedDefinitions as $plugin_id => $definition) {
$discovery
->deleteDefinition($plugin_id);
}
$this->emptyDiscovery = $discovery;
}
}