Skip to content

Commit

Permalink
feat: Add cronExpression param
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Syomkin committed Dec 27, 2024
1 parent 5606101 commit a20fc11
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/src/ScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Spiral\Scheduler\Tests;

use Cron\CronExpression;
use Spiral\Scheduler\CommandRunner;
use Spiral\Scheduler\Mutex\JobMutexInterface;
use Spiral\Scheduler\ProcessFactory;
Expand Down Expand Up @@ -43,6 +44,18 @@ public function testRegisterCommandByClassname(): void
$this->registry->assertRegisteredJob($job);
}

public function testRegisterCommandWithCronExpression(): void
{
$job = $this->schedule
->command(SimpleCommand::class, ['baz' => 'biz'], 'Simple job', new CronExpression('*/2 * * * *'));

$this->assertSame('/usr/bin/php app.php foo:bar baz=\'biz\'', $job->getName());
$this->assertSame('Simple command', $job->getDescription());
$this->assertSame('*/2 * * * *', $job->getExpression());

$this->registry->assertRegisteredJob($job);
}

public function testRegisterCallableJob(): void
{
$job = $this->schedule
Expand Down

0 comments on commit a20fc11

Please sign in to comment.