From d14e93eacef2fdcd71cdd3dd131baa4272b000bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Barto=C5=A1?= Date: Sun, 28 Apr 2024 02:19:28 +0200 Subject: [PATCH] SymfonyCommandJob -> SymfonyConsoleJob --- CHANGELOG.md | 2 +- docs/README.md | 8 ++++---- ...nyCommandJob.php => SymfonyConsoleJob.php} | 2 +- ...dJobTest.php => SymfonyConsoleJobTest.php} | 20 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) rename src/Job/{SymfonyCommandJob.php => SymfonyConsoleJob.php} (98%) rename tests/Unit/Job/{SymfonyCommandJobTest.php => SymfonyConsoleJobTest.php} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c493468..7ef9dc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - explains cron expression syntax - `ListCommand` - adds `--explain` option to explain whole expression -- `SymfonyCommandJob` +- `SymfonyConsoleJob` - `JobInfo` - `getTimeZone()` returns timezone job should run in - `isForcedRun()`returns whether job was run via $scheduler->runJob() or scheduler:run-job command, ignoring the cron expression diff --git a/docs/README.md b/docs/README.md index 228c79d..2dd10c1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -23,7 +23,7 @@ Cron job scheduler - with locks, parallelism and more - [Job types](#job-types) - [Callback job](#callback-job) - [Custom job](#custom-job) - - [Symfony command job](#symfony-command-job) + - [Symfony console job](#symfony-console-job) - [Job info and result](#job-info-and-result) - [Run summary](#run-summary) - [Run single job](#run-single-job) @@ -579,7 +579,7 @@ $scheduler->addJob( ); ``` -### Symfony command job +### Symfony console job Run [symfony/console](https://github.com/symfony/console) command as a job @@ -588,9 +588,9 @@ Run [symfony/console](https://github.com/symfony/console) command as a job command, the exception ```php -use Orisai\Scheduler\Job\SymfonyCommandJob; +use Orisai\Scheduler\Job\SymfonyConsoleJob; -$job = new SymfonyCommandJob($command, $application); +$job = new SymfonyConsoleJob($command, $application); $scheduler->addJob( $job, /* ... */, diff --git a/src/Job/SymfonyCommandJob.php b/src/Job/SymfonyConsoleJob.php similarity index 98% rename from src/Job/SymfonyCommandJob.php rename to src/Job/SymfonyConsoleJob.php index ad1308d..9987d4d 100644 --- a/src/Job/SymfonyCommandJob.php +++ b/src/Job/SymfonyConsoleJob.php @@ -13,7 +13,7 @@ use function assert; use function is_numeric; -final class SymfonyCommandJob implements Job +final class SymfonyConsoleJob implements Job { private Command $command; diff --git a/tests/Unit/Job/SymfonyCommandJobTest.php b/tests/Unit/Job/SymfonyConsoleJobTest.php similarity index 90% rename from tests/Unit/Job/SymfonyCommandJobTest.php rename to tests/Unit/Job/SymfonyConsoleJobTest.php index b271707..12ff8aa 100644 --- a/tests/Unit/Job/SymfonyCommandJobTest.php +++ b/tests/Unit/Job/SymfonyConsoleJobTest.php @@ -6,7 +6,7 @@ use Orisai\Exceptions\Logic\InvalidState; use Orisai\Exceptions\Logic\NotImplemented; use Orisai\Scheduler\Job\JobLock; -use Orisai\Scheduler\Job\SymfonyCommandJob; +use Orisai\Scheduler\Job\SymfonyConsoleJob; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Lock\NoLock; @@ -18,7 +18,7 @@ use Tests\Orisai\Scheduler\Doubles\TestSuccessCommand; use Tests\Orisai\Scheduler\Helpers\CommandOutputHelper; -final class SymfonyCommandJobTest extends TestCase +final class SymfonyConsoleJobTest extends TestCase { public function testSuccess(): void @@ -26,7 +26,7 @@ public function testSuccess(): void $command = new TestSuccessCommand(); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); self::assertStringMatchesFormat('symfony/console: %ctest:success%c', $job->getName()); @@ -39,7 +39,7 @@ public function testFailNoOutput(): void $command = new TestFailNoOutputCommand(); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); self::assertStringMatchesFormat('symfony/console: %ctest:fail-no-output%c', $job->getName()); @@ -67,7 +67,7 @@ public function testFailOutput(): void $command = new TestFailOutputCommand(); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); self::assertStringMatchesFormat('symfony/console: %ctest:fail-output%c', $job->getName()); @@ -101,7 +101,7 @@ public function testException(int $exceptionCode, int $commandCode): void $command = new TestExceptionCommand($exceptionCode); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); self::assertStringMatchesFormat('symfony/console: %ctest:exception%c', $job->getName()); @@ -147,7 +147,7 @@ public function testApplicationSettingsHaveNoEffect(bool $autoExit, bool $catchE $application->setAutoExit($autoExit); $application->setCatchExceptions($catchExceptions); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); self::assertStringMatchesFormat('symfony/console: %ctest:exception%c', $job->getName()); @@ -176,7 +176,7 @@ public function testCommandNameCannotBeChanged(): void $command = new TestSuccessCommand(); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); // Is ignored $job->setCommandParameters(['command' => 'non-existent']); @@ -192,7 +192,7 @@ public function testCommandParameters(): void $command = new TestParametrizedCommand(); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); $job->setCommandParameters([ 'argument' => 'a', '--option' => 'b', @@ -213,7 +213,7 @@ public function testLockTtl(): void $command = new TestSuccessCommand(); $application = new Application(); $application->add($command); - $job = new SymfonyCommandJob($command, $application); + $job = new SymfonyConsoleJob($command, $application); $job->setLockTtl(0.1); $lock = new TestLock();