This bundle provides a set of constraints built on top of the API to assert on task lifecycle.
Constraint | Description |
---|---|
TaskExecuted |
Assert on the executed task count |
TaskFailed |
Assert on the failed task count |
TaskQueued |
Assert on the queued task count |
TaskScheduled |
Assert on the scheduled task count |
TaskUnscheduled |
Assert on the unscheduled task count |
Constraint | Description |
---|---|
ProbeEnabled |
Assert on the probe state |
ProbeExecutedTask |
Assert on the unscheduled task count |
ProbeFailedTask |
Assert on the unscheduled task count |
ProbeScheduledTask |
Assert on the unscheduled task count |
ProbeState |
Assert against the current probe state |
Constraint | Description |
---|---|
SchedulerDueTask |
Assert on the due tasks count |
A little bonus is the SchedulerAssertionTrait
that can be used on tests that extend KernelTestCase
:
<?php
declare(strict_types=1);
use SchedulerBundle\Test\SchedulerAssertionTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
final class FooTest extends KernelTestCase
{
use SchedulerAssertionTrait;
public function testFoo(): void
{
// TODO
self::assertTaskExecutedCount(1);
}
}
The complete list of assertions can be found in the trait.