Skip to content

Commit

Permalink
Merge branch 'hotfix/2.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Burak Bolat committed Mar 1, 2024
2 parents 6d41f5c + 35c051b commit 04588c2
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.3.2 (March 01, 2024)
- Fix an inactive task to process

## 2.3.1 (February 01, 2024)
- Add doctrine/annotations version 2 support

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.3.2
5 changes: 5 additions & 0 deletions src/Command/ScheduledTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Goksagun\SchedulerBundle\Command\Utils\TaskValidator;
use Goksagun\SchedulerBundle\Entity\ScheduledTaskLog;
use Goksagun\SchedulerBundle\Enum\ResourceInterface;
use Goksagun\SchedulerBundle\Enum\StatusInterface;
use Goksagun\SchedulerBundle\Process\ProcessInfo;
use Goksagun\SchedulerBundle\Service\ScheduledTaskLogService;
use Goksagun\SchedulerBundle\Service\ScheduledTaskService;
Expand Down Expand Up @@ -268,6 +269,10 @@ private function handleTaskException(
private function getTasks(): \Generator
{
foreach ($this->tasks as $task) {
if ($task['status'] === StatusInterface::STATUS_INACTIVE) {
continue;
}

yield $task;
}
}
Expand Down
46 changes: 46 additions & 0 deletions tests/Command/ScheduledTaskCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,52 @@ public function testNoOutputTaskCommand()
$this->assertEquals("The 'no:output' completed!\n", $output);
}

public function testInactiveTaskCommand()
{
$config = $this->createConfigMock(
true,
false,
false,
[
[
'name' => 'no:output',
'expression' => '* * * * *',
'start' => null,
'stop' => null,
'times' => null,
'status' => StatusInterface::STATUS_INACTIVE,
],
]
);
$application = $this->getApplication();
$entityManager = $this->createEntityManagerMock();
$scheduledTaskService = $this->createScheduledTaskService([], $config, $application);
$scheduledTaskLogService = $this->createScheduledTaskLogService();
$taskLoader = $this->getTaskLoader($scheduledTaskService);

$application->add(new NoOutputCommand());
$application->add(
new ScheduledTaskCommand(
$entityManager,
$scheduledTaskService,
$scheduledTaskLogService,
$taskLoader
)
);

$command = $application->find('scheduler:run');
$commandTester = new CommandTester($command);
$commandTester->execute(
[
'command' => $command->getName(),
]
);

$output = $commandTester->getDisplay();

$this->assertEquals("", $output);
}

public function testGreetingSayHelloWithArgumentTaskCommand()
{
$config = $this->createConfigMock(
Expand Down

0 comments on commit 04588c2

Please sign in to comment.