PluginManagerTest.php in Purge 8.3
Same filename in this branch
- 8.3 tests/src/Kernel/Purger/PluginManagerTest.php
- 8.3 tests/src/Kernel/Processor/PluginManagerTest.php
- 8.3 tests/src/Kernel/Queue/PluginManagerTest.php
- 8.3 tests/src/Kernel/Invalidation/PluginManagerTest.php
- 8.3 tests/src/Kernel/TagsHeader/PluginManagerTest.php
- 8.3 tests/src/Kernel/Queuer/PluginManagerTest.php
- 8.3 tests/src/Kernel/DiagnosticCheck/PluginManagerTest.php
Namespace
Drupal\Tests\purge\Kernel\TagsHeaderFile
tests/src/Kernel/TagsHeader/PluginManagerTest.phpView source
<?php
namespace Drupal\Tests\purge\Kernel\TagsHeader;
use Drupal\purge\Plugin\Purge\TagsHeader\PluginManager;
use Drupal\Tests\purge\Kernel\KernelPluginManagerTestBase;
/**
* Tests \Drupal\purge\Plugin\Purge\TagsHeader\PluginManager.
*
* @group purge
*/
class PluginManagerTest extends KernelPluginManagerTestBase {
/**
* {@inheritdoc}
*/
protected $pluginManagerClass = PluginManager::class;
/**
* {@inheritdoc}
*/
public static $modules = [
'purge_tagsheader_test',
];
/**
* All metadata from \Drupal\purge\Annotation\PurgeTagsHeader.
*
* @var string[]
*/
protected $annotationFields = [
'provider',
'class',
'id',
'header_name',
'dependent_purger_plugins',
];
/**
* All bundled plugins in purge core, including in the test module.
*
* @var string[]
*/
protected $plugins = [
'a',
'b',
'c',
];
/**
* Test the plugins we expect to be available.
*/
public function testDefinitions() : void {
$definitions = $this->pluginManager
->getDefinitions();
foreach ($this->plugins as $plugin_id) {
$this
->assertTrue(isset($definitions[$plugin_id]));
}
foreach ($definitions as $plugin_id => $md) {
$this
->assertTrue(in_array($plugin_id, $this->plugins));
}
foreach ($definitions as $plugin_id => $md) {
foreach ($md as $field => $value) {
$this
->assertTrue(in_array($field, $this->annotationFields));
}
foreach ($this->annotationFields as $field) {
$this
->assertTrue(isset($md[$field]));
}
}
}
}
Classes
Name | Description |
---|---|
PluginManagerTest | Tests \Drupal\purge\Plugin\Purge\TagsHeader\PluginManager. |