function SchedulerPluginTest::testDiscovery in Ultimate Cron 8.2
Tests that scheduler plugins are discovered correctly.
File
- tests/
src/ Kernel/ SchedulerPluginTest.php, line 26
Class
- SchedulerPluginTest
- Tests the default scheduler plugins.
Namespace
Drupal\Tests\ultimate_cron\KernelCode
function testDiscovery() {
/* @var \Drupal\Core\Plugin\DefaultPluginManager $manager */
$manager = \Drupal::service('plugin.manager.ultimate_cron.scheduler');
$plugins = $manager
->getDefinitions();
$this
->assertCount(2, $plugins);
$simple = $manager
->createInstance('simple');
$this
->assertTrue($simple instanceof Simple);
$this
->assertEquals('simple', $simple
->getPluginId());
$crontab = $manager
->createInstance('crontab');
$this
->assertTrue($crontab instanceof Crontab);
$this
->assertEquals('crontab', $crontab
->getPluginId());
}