You are here

function LoggerPluginTest::testDiscovery in Ultimate Cron 8.2

Tests that scheduler plugins are discovered correctly.

File

tests/src/Kernel/LoggerPluginTest.php, line 28

Class

LoggerPluginTest
Tests the default scheduler plugins.

Namespace

Drupal\Tests\ultimate_cron\Kernel

Code

function testDiscovery() {

  /* @var \Drupal\Core\Plugin\DefaultPluginManager $manager */
  $manager = \Drupal::service('plugin.manager.ultimate_cron.logger');
  $plugins = $manager
    ->getDefinitions();
  $this
    ->assertCount(2, $plugins);
  $cache = $manager
    ->createInstance('cache');
  $this
    ->assertTrue($cache instanceof CacheLogger);
  $this
    ->assertEquals('cache', $cache
    ->getPluginId());
  $database = $manager
    ->createInstance('database');
  $this
    ->assertTrue($database instanceof DatabaseLogger);
  $this
    ->assertEquals('database', $database
    ->getPluginId());
}