Skip to content

Commit

Permalink
updated symfony components (php-task#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored Sep 10, 2019
1 parent da612fe commit a71c957
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 11 deletions.
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ language: php
matrix:
fast_finish: true
include:
- php: 5.5
- php: 5.6
env:
- CODE_COVERAGE=true
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
- php: 5.6
- php: 7.0
env:
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
- php: 7.0
- php: 7.1
env:
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
- php: 7.1
env:
- CODE_COVERAGE=true

install:
- composer self-update
- composer update
- composer update $COMPOSER_FLAGS
- composer info

script:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
],
"require": {
"php": "~5.5 || ~7.0",
"php": "^5.6 || ^7.0",
"doctrine/common": "^2.6",
"ramsey/uuid": "^3.1",
"symfony/event-dispatcher": "^2.6 || ^3.0",
"symfony/event-dispatcher": "^2.6 || ^3.4 || ^4.0",
"mtdowling/cron-expression": "^1.1"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Task/Runner/TaskRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private function finalize(TaskExecutionInterface $execution, $start)
// invalid (clear in doctrine) after handling an execution.
$execution = $this->taskExecutionRepository->findByUuid($execution->getUuid());

if ($execution->getStatus() !== TaskStatus::PLANNED) {
if (TaskStatus::PLANNED !== $execution->getStatus()) {
$execution->setEndTime(new \DateTime());
$execution->setDuration(microtime(true) - $start);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Task/Scheduler/TaskScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function scheduleTask(TaskInterface $task)
return;
}

if ($task->getInterval() === null && 0 < count($this->taskExecutionRepository->findByTask($task))) {
if (null === $task->getInterval() && 0 < count($this->taskExecutionRepository->findByTask($task))) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function (TaskExecutionInterface $execution) use ($task) {
}
);

if ($filtered->count() === 0) {
if (0 === $filtered->count()) {
return;
}

Expand All @@ -107,7 +107,7 @@ function (TaskExecutionInterface $execution) use ($uuid) {
}
);

if ($filtered->count() === 0) {
if (0 === $filtered->count()) {
return;
}

Expand Down Expand Up @@ -153,7 +153,7 @@ public function findNextScheduled(\DateTime $dateTime = null, array $skippedExec

$result = $this->taskExecutionCollection->filter(
function (TaskExecutionInterface $execution) use ($dateTime, $skippedExecutions) {
return $execution->getStatus() === TaskStatus::PLANNED
return TaskStatus::PLANNED === $execution->getStatus()
&& $execution->getScheduleTime() < $dateTime
&& !in_array($execution->getUuid(), $skippedExecutions);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Task/Storage/ArrayStorage/ArrayTaskRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function findEndBeforeNow()
return array_values(
$this->taskCollection->filter(
function (TaskInterface $task) use ($now) {
return $task->getLastExecution() === null || $task->getLastExecution() > $now;
return null === $task->getLastExecution() || $task->getLastExecution() > $now;
}
)->toArray()
);
Expand Down
4 changes: 4 additions & 0 deletions src/Task/TaskStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
final class TaskStatus
{
const PLANNED = 'planned';

const RUNNING = 'running';

const COMPLETED = 'completed';

const ABORTED = 'aborted';

const FAILED = 'failed';

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Runner/PendingExecutionFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class PendingExecutionFinderTest extends \PHPUnit_Framework_TestCase
{
const HANDLER = 'AppBundle\\Handler\\TestHandler';

const LOCKING_HANDLER = 'AppBundle\\Handler\\LockingTestHandler';

/**
Expand Down

0 comments on commit a71c957

Please sign in to comment.