Skip to content

Commit

Permalink
SymfonyCommandJob -> SymfonyConsoleJob
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Apr 28, 2024
1 parent 9a8fb9a commit d14e93e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -579,7 +579,7 @@ $scheduler->addJob(
);
```

### Symfony command job
### Symfony console job

Run [symfony/console](https://github.com/symfony/console) command as a job

Expand All @@ -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,
/* ... */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use function assert;
use function is_numeric;

final class SymfonyCommandJob implements Job
final class SymfonyConsoleJob implements Job
{

private Command $command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,15 +18,15 @@
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
{
$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());

Expand All @@ -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());

Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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']);

Expand All @@ -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',
Expand All @@ -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();
Expand Down

0 comments on commit d14e93e

Please sign in to comment.