How to run the test suite and write tests for the Caeligo Scheduler Bundle.
composer install
vendor/bin/phpunit
# Unit tests only
vendor/bin/phpunit --testsuite=Unit
# Integration tests only
vendor/bin/phpunit --testsuite=Integration
# Functional tests only
vendor/bin/phpunit --testsuite=Functional
vendor/bin/phpunit --filter=CronExpressionParserTest
vendor/bin/phpunit --filter=testIsValidExpression
tests/
├── Unit/
│ ├── Attribute/
│ │ └── AsSchedulableCommandTest.php
│ ├── DependencyInjection/
│ │ └── ConfigurationTest.php
│ ├── Enum/
│ │ └── TaskRunStatusTest.php
│ ├── Service/
│ │ ├── CommandDiscoveryServiceTest.php
│ │ ├── CronExpressionParserTest.php
│ │ ├── CrontabManagerTest.php
│ │ ├── StateManagerTest.php
│ │ └── TaskDispatcherTest.php
│ └── Twig/
│ └── SchedulerExtensionTest.php
├── Integration/
└── Functional/
Tests cron expression parsing, interval calculation, human-readable descriptions, and due-checking:
describe() output for common patternsisTaskDue() unified checksTests file-based state and log storage using a temporary directory:
Tests attribute-based command discovery using a real Symfony Application with test command fixtures:
#[AsSchedulableCommand] commandsTests crontab line generation (mocked Process for actual crontab operations):
Tests the execution engine with mocked CommandDiscoveryService:
Tests the enum values, labels, and badge classes.
Tests the attribute constructor, default values, and PHP attribute metadata.
Tests the Symfony config tree processing with defaults and custom values.
Tests all Twig filters: describe, badge, formatDuration, timeAgo.
When writing integration tests for the bundle in a host project:
use Caeligo\SchedulerBundle\Service\TaskDispatcher;
class MySchedulerTest extends KernelTestCase
{
public function testSchedulerDiscoversMyCommands(): void
{
self::bootKernel();
$dispatcher = self::getContainer()->get(TaskDispatcher::class);
$tasks = $dispatcher->getAllTasks();
$this->assertArrayHasKey('app:my-command', $tasks);
}
}
How can I help you explore Laravel packages today?