CronEventTest.php in Hook Event Dispatcher 3.x
File
modules/core_event_dispatcher/tests/src/Kernel/CronEventTest.php
View source
<?php
namespace Drupal\Tests\core_event_dispatcher\Kernel;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Drupal\KernelTests\KernelTestBase;
class CronEventTest extends KernelTestBase {
protected static $modules = [
'hook_event_dispatcher',
'core_event_dispatcher',
];
public function testCronEvent() {
$called = FALSE;
$this->container
->get('event_dispatcher')
->addListener(HookEventDispatcherInterface::CRON, function () use (&$called) {
$called = TRUE;
});
$this->container
->get('cron')
->run();
$this
->assertTrue($called);
}
}
Classes
Name |
Description |
CronEventTest |
@group hook_event_dispatcher
@group core_event_dispatcher |