You are here

public function PluginManagerTest::testDefinitions in Purge 8.3

Same name in this branch
  1. 8.3 tests/src/Kernel/Purger/PluginManagerTest.php \Drupal\Tests\purge\Kernel\Purger\PluginManagerTest::testDefinitions()
  2. 8.3 tests/src/Kernel/Processor/PluginManagerTest.php \Drupal\Tests\purge\Kernel\Processor\PluginManagerTest::testDefinitions()
  3. 8.3 tests/src/Kernel/Queue/PluginManagerTest.php \Drupal\Tests\purge\Kernel\Queue\PluginManagerTest::testDefinitions()
  4. 8.3 tests/src/Kernel/Invalidation/PluginManagerTest.php \Drupal\Tests\purge\Kernel\Invalidation\PluginManagerTest::testDefinitions()
  5. 8.3 tests/src/Kernel/TagsHeader/PluginManagerTest.php \Drupal\Tests\purge\Kernel\TagsHeader\PluginManagerTest::testDefinitions()
  6. 8.3 tests/src/Kernel/Queuer/PluginManagerTest.php \Drupal\Tests\purge\Kernel\Queuer\PluginManagerTest::testDefinitions()
  7. 8.3 tests/src/Kernel/DiagnosticCheck/PluginManagerTest.php \Drupal\Tests\purge\Kernel\DiagnosticCheck\PluginManagerTest::testDefinitions()

Test the plugins we expect to be available.

File

tests/src/Kernel/Invalidation/PluginManagerTest.php, line 56

Class

PluginManagerTest
Tests \Drupal\purge\Plugin\Purge\Invalidation\PluginManager.

Namespace

Drupal\Tests\purge\Kernel\Invalidation

Code

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]));
    }
  }
}