Skip to content

Commit 5e39020

Browse files
updated symfony components
1 parent 1c341d7 commit 5e39020

File tree

19 files changed

+137
-64
lines changed

19 files changed

+137
-64
lines changed

.travis.yml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,79 @@ language: php
33
matrix:
44
fast_finish: true
55
include:
6-
- php: 5.5
6+
- php: 5.6
77
env:
88
- STORAGE=doctrine
9-
- php: 5.5
10-
env:
11-
- STORAGE=array
9+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
1210
- php: 5.6
1311
env:
1412
- STORAGE=doctrine
15-
- CODE_COVERAGE=true
1613
- php: 5.6
1714
env:
1815
- STORAGE=array
16+
- php: 7.0
17+
env:
18+
- STORAGE=doctrine
19+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
1920
- php: 7.0
2021
env:
2122
- STORAGE=doctrine
2223
- php: 7.0
2324
env:
2425
- STORAGE=array
26+
- php: 7.0
27+
env:
28+
- STORAGE=doctrine
29+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
30+
- php: 7.0
31+
env:
32+
- STORAGE=doctrine
33+
- php: 7.1
34+
env:
35+
- STORAGE=array
36+
- php: 7.1
37+
env:
38+
- STORAGE=doctrine
39+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
40+
- php: 7.1
41+
env:
42+
- STORAGE=doctrine
43+
- CODE_COVERAGE="--coverage-clover=coverage.clover"
44+
- php: 7.2
45+
env:
46+
- STORAGE=array
47+
- php: 7.2
48+
env:
49+
- STORAGE=doctrine
50+
- COMPOSER_FLAGS="--prefer-lowest --prefer-dist --no-interaction"
51+
- php: 7.2
52+
env:
53+
- STORAGE=doctrine
54+
- php: 7.3
55+
env:
56+
- STORAGE=array
57+
- php: 7.3
58+
env:
59+
- STORAGE=doctrine
60+
61+
before_install:
62+
- if [[ -z $CODE_COVERAGE ]]; then phpenv config-rm xdebug.ini ; fi
63+
- phpenv config-add tests/travis.php.ini
2564

2665
install:
27-
- composer self-update
28-
- composer update
66+
- composer update $COMPOSER_FLAGS
2967
- composer info
3068

3169
before_script:
32-
- STORAGE=doctrine tests/app/console doctrine:database:create
33-
- STORAGE=doctrine tests/app/console doctrine:schema:create
70+
- if [[ $STORAGE == 'doctrine' ]]; then tests/app/console doctrine:database:create ; fi
71+
- if [[ $STORAGE == 'doctrine' ]]; then tests/app/console doctrine:schema:create ; fi
3472

3573
script:
36-
- vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.clover
74+
- vendor/bin/phpunit -c phpunit.xml.dist $CODE_COVERAGE
3775

3876
after_script:
39-
- if [[ $CODE_COVERAGE == 'true' ]]; then wget https://scrutinizer-ci.com/ocular.phar ; fi
40-
- if [[ $CODE_COVERAGE == 'true' ]]; then php ocular.phar code-coverage:upload --access-token="230ec5e01daf5bb3e46ea304fb20348b52d80de73463ec08ee9c96fcd1349e35" --format=php-clover coverage.clover ; fi
77+
- if [[ -n $CODE_COVERAGE ]]; then wget https://scrutinizer-ci.com/ocular.phar ; fi
78+
- if [[ -n $CODE_COVERAGE ]]; then php ocular.phar code-coverage:upload --access-token="230ec5e01daf5bb3e46ea304fb20348b52d80de73463ec08ee9c96fcd1349e35" --format=php-clover coverage.clover ; fi
4179

4280
cache:
4381
directories:

composer.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@
1010
}
1111
],
1212
"require": {
13-
"php": "~5.5 || ~7.0",
14-
"php-task/php-task": "^1.2",
15-
"symfony/http-kernel": "^2.6 || ^3.0",
16-
"symfony/dependency-injection": "^2.6 || ^3.0",
17-
"symfony/expression-language": "^2.6 || ^3.0",
18-
"symfony/config": "^2.6 || ^3.0",
19-
"symfony/console": "^2.6 || ^3.0",
20-
"symfony/process": "^2.6 || ^3.0",
13+
"php": "^5.6 || ^7.0",
14+
"php-task/php-task": "^1.3",
15+
"symfony/http-kernel": "^2.8 || ^3.4 || ^4.0",
16+
"symfony/dependency-injection": "^2.8 || ^3.4 || ^4.0",
17+
"symfony/expression-language": "^2.8 || ^3.4 || ^4.0",
18+
"symfony/config": "^2.8 || ^3.4 || ^4.0",
19+
"symfony/console": "^2.8 || ^3.4 || ^4.0",
20+
"symfony/process": "^2.8 || ^3.4 || ^4.0",
2121
"doctrine/orm": "^2.5"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^4.8",
25-
"symfony/framework-bundle": "^2.6",
26-
"symfony/finder": "^2.6",
24+
"phpunit/phpunit": "^4.8 || ^5.0",
25+
"sebastian/comparator": "^1.2.3",
26+
"symfony/debug": "^2.8 || ^3.4 || ^4.0",
27+
"symfony/framework-bundle": "^2.8 || ^3.4 || ^4.0",
28+
"symfony/finder": "^2.8 || ^3.4 || ^4.0",
29+
"symfony/yaml": "^2.8 || ^3.4 || ^4.0",
2730
"doctrine/doctrine-bundle": "^1.5",
2831
"doctrine/data-fixtures": "^1.1"
2932
},

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
7-
bootstrap="vendor/autoload.php">
7+
bootstrap="tests/bootstrap.php">
88
<php>
99
<ini name="error_reporting" value="-1" />
1010
<server name="KERNEL_DIR" value="tests/app" />
11+
<server name="KERNEL_CLASS" value="TestKernel" />
1112
</php>
1213

1314
<testsuites>

src/DependencyInjection/TaskExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function loadDoctrineAdapter(array $config, ContainerBuilder $container)
8989
*/
9090
private function loadLockingComponent(array $config, ContainerBuilder $container, LoaderInterface $loader)
9191
{
92-
if (!$config['enabled']) {
92+
if (!$config['enabled'] || 'null' === $config['storage']) {
9393
return $loader->load('locking/null.xml');
9494
}
9595

@@ -135,7 +135,7 @@ private function getLockingStorageAliases(ContainerBuilder $container)
135135
{
136136
$taggedServices = $container->findTaggedServiceIds('task.lock.storage');
137137

138-
$result = [];
138+
$result = ['null'];
139139
foreach ($taggedServices as $id => $tags) {
140140
foreach ($tags as $tag) {
141141
$result[$tag['alias']] = $id;

src/Executor/ExecutionProcessFactory.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Task\TaskBundle\Executor;
44

55
use Symfony\Component\Process\Process;
6-
use Symfony\Component\Process\ProcessBuilder;
76

87
/**
98
* Factory for execution-process.
@@ -46,10 +45,8 @@ public function __construct($consolePath, $processTimeout, $environment)
4645
*/
4746
public function create($uuid)
4847
{
49-
return $process = ProcessBuilder::create(
50-
[$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]
51-
)
52-
->setTimeout($this->processTimeout)
53-
->getProcess();
48+
return $process = (new Process(
49+
implode(' ', [$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment])
50+
))->setTimeout($this->processTimeout);
5451
}
5552
}

src/Resources/config/command.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.command.run" class="Task\TaskBundle\Command\RunCommand">
6+
<service id="task.command.run" class="Task\TaskBundle\Command\RunCommand" public="true">
77
<argument type="string">task:run</argument>
88
<argument type="service" id="task.runner"/>
99
<argument type="service" id="task.scheduler"/>
@@ -12,30 +12,30 @@
1212
<tag name="console.command"/>
1313
</service>
1414

15-
<service id="task.command.run_handler" class="Task\TaskBundle\Command\RunHandlerCommand">
15+
<service id="task.command.run_handler" class="Task\TaskBundle\Command\RunHandlerCommand" public="true">
1616
<argument type="string">task:run:handler</argument>
1717
<argument type="service" id="task.handler.factory"/>
1818

1919
<tag name="console.command"/>
2020
</service>
2121

22-
<service id="task.command.executor" class="Task\TaskBundle\Command\ExecuteCommand">
22+
<service id="task.command.executor" class="Task\TaskBundle\Command\ExecuteCommand" public="true">
2323
<argument type="string">task:execute</argument>
2424
<argument type="service" id="task.handler.factory"/>
2525
<argument type="service" id="task.storage.task_execution"/>
2626

2727
<tag name="console.command"/>
2828
</service>
2929

30-
<service id="task.command.schedule_task" class="Task\TaskBundle\Command\ScheduleTaskCommand">
30+
<service id="task.command.schedule_task" class="Task\TaskBundle\Command\ScheduleTaskCommand" public="true">
3131
<argument type="string">task:schedule</argument>
3232
<argument type="service" id="task.scheduler"/>
3333
<!-- add entity_manager if doctrine storage is enabled -->
3434

3535
<tag name="console.command"/>
3636
</service>
3737

38-
<service id="task.command.debug_tasks" class="Task\TaskBundle\Command\DebugTasksCommand">
38+
<service id="task.command.debug_tasks" class="Task\TaskBundle\Command\DebugTasksCommand" public="true">
3939
<argument type="string">debug:tasks</argument>
4040
<argument type="service" id="task.storage.task_execution"/>
4141

src/Resources/config/executor/inside.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.executor.inside" class="Task\Executor\InsideProcessExecutor">
6+
<service id="task.executor.inside" class="Task\Executor\InsideProcessExecutor" public="true">
77
<argument type="service" id="task.handler.factory"/>
88
</service>
99
</services>

src/Resources/config/executor/separate.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.executor.separate" class="Task\TaskBundle\Executor\SeparateProcessExecutor">
6+
<service id="task.executor.separate" class="Task\TaskBundle\Executor\SeparateProcessExecutor" public="true">
77
<argument type="service" id="task.handler.factory"/>
88
<argument type="service" id="task.storage.task_execution"/>
99
<argument type="service" id="task.executor.separate.process_factory"/>
1010
</service>
1111

12-
<service id="task.executor.separate.process_factory" class="Task\TaskBundle\Executor\ExecutionProcessFactory">
12+
<service id="task.executor.separate.process_factory" class="Task\TaskBundle\Executor\ExecutionProcessFactory" public="true">
1313
<argument type="string">%task.executor.console_path%</argument>
1414
<argument type="string">%task.executor.process_timeout%</argument>
1515
<argument type="string">%kernel.environment%</argument>

src/Resources/config/listener.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.event_listener.run" class="Task\TaskBundle\EventListener\RunListener">
6+
<service id="task.event_listener.run" class="Task\TaskBundle\EventListener\RunListener" public="true">
77
<argument type="service" id="task.runner" />
88

99
<tag name="kernel.event_listener" event="kernel.terminate" method="run" />

src/Resources/config/locking/null.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.lock" class="Task\TaskBundle\Locking\NullLock"/>
6+
<service id="task.lock" class="Task\TaskBundle\Locking\NullLock" public="true"/>
77
</services>
88
</container>

src/Resources/config/locking/services.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.lock" class="Task\Lock\Lock">
6+
<service id="task.lock" class="Task\Lock\Lock" public="true">
77
<argument type="service" id="task.lock.storage"/>
88
<argument>%task.lock.ttl%</argument>
99
</service>

src/Resources/config/locking/storages.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.lock.storage.file" class="Task\Lock\Storage\FileLockStorage">
6+
<service id="task.lock.storage.file" class="Task\Lock\Storage\FileLockStorage" public="true">
77
<argument type="expression">parameter('task.lock.storages.file')['directory']</argument>
88

99
<tag name="task.lock.storage" alias="file"/>

src/Resources/config/scheduler.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.builder_factory" class="Task\TaskBundle\Builder\TaskBuilderFactory"/>
6+
<service id="task.builder_factory" class="Task\TaskBundle\Builder\TaskBuilderFactory" public="true"/>
77

8-
<service id="task.scheduler" class="Task\Scheduler\TaskScheduler">
8+
<service id="task.scheduler" class="Task\Scheduler\TaskScheduler" public="true">
99
<argument type="service" id="task.builder_factory"/>
1010
<argument type="service" id="task.storage.task"/>
1111
<argument type="service" id="task.storage.task_execution"/>
1212
<argument type="service" id="event_dispatcher"/>
1313
</service>
1414

15-
<service id="task.handler.factory" class="Task\TaskBundle\Handler\TaskHandlerFactory">
15+
<service id="task.handler.factory" class="Task\TaskBundle\Handler\TaskHandlerFactory" public="true">
1616
<argument type="collection"/>
1717
</service>
1818

19-
<service id="task.runner.execution_finder" class="Task\Runner\PendingExecutionFinder">
19+
<service id="task.runner.execution_finder" class="Task\Runner\PendingExecutionFinder" public="true">
2020
<argument type="service" id="task.storage.task_execution"/>
2121
<argument type="service" id="task.handler.factory"/>
2222
<argument type="service" id="task.lock"/>
2323
<argument type="service" id="logger" on-invalid="ignore"/>
2424
</service>
2525

26-
<service id="task.runner" class="Task\Runner\TaskRunner">
26+
<service id="task.runner" class="Task\Runner\TaskRunner" public="true">
2727
<argument type="service" id="task.storage.task_execution"/>
2828
<argument type="service" id="task.runner.execution_finder"/>
2929
<argument type="service" id="task.executor"/>

src/Resources/config/storage/array.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.storage.task" class="Task\Storage\ArrayStorage\ArrayTaskRepository"/>
7-
<service id="task.storage.task_execution" class="Task\Storage\ArrayStorage\ArrayTaskExecutionRepository"/>
6+
<service id="task.storage.task" class="Task\Storage\ArrayStorage\ArrayTaskRepository" public="true"/>
7+
<service id="task.storage.task_execution" class="Task\Storage\ArrayStorage\ArrayTaskExecutionRepository" public="true"/>
88
</services>
99
</container>

src/Resources/config/storage/doctrine.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55
<services>
6-
<service id="task.repository.task" class="Task\TaskBundle\Entity\TaskRepository">
6+
<service id="task.repository.task" class="Task\TaskBundle\Entity\TaskRepository" public="true">
77
<factory service="doctrine.orm.entity_manager" method="getRepository"/>
88

99
<argument type="string">TaskBundle:Task</argument>
1010
</service>
11-
<service id="task.storage.task" alias="task.repository.task"/>
11+
<service id="task.storage.task" alias="task.repository.task" public="true"/>
1212

13-
<service id="task.repository.task_execution" class="Task\TaskBundle\Entity\TaskExecutionRepository">
13+
<service id="task.repository.task_execution" class="Task\TaskBundle\Entity\TaskExecutionRepository" public="true">
1414
<factory service="doctrine.orm.entity_manager" method="getRepository"/>
1515

1616
<argument type="string">TaskBundle:TaskExecution</argument>
1717
</service>
18-
<service id="task.storage.task_execution" alias="task.repository.task_execution"/>
18+
<service id="task.storage.task_execution" alias="task.repository.task_execution" public="true"/>
1919

20-
<service id="task.command.schedule_system_tasks" class="Task\TaskBundle\Command\ScheduleSystemTasksCommand">
20+
<service id="task.command.schedule_system_tasks" class="Task\TaskBundle\Command\ScheduleSystemTasksCommand" public="true">
2121
<argument type="string">task:schedule:system-tasks</argument>
2222
<argument>%task.system_tasks%</argument>
2323
<argument type="service" id="task.scheduler"/>

tests/Functional/Command/RunCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testExecute()
4343
);
4444

4545
$execution = $this->taskExecutionRepository->findByUuid($executions[0]->getUuid());
46-
$this->assertEquals(TaskStatus::COMPLETED, $execution->getStatus());
46+
$this->assertEquals(TaskStatus::COMPLETED, $execution->getStatus(), $execution->getException());
4747
$this->assertEquals(strrev('Test workload 1'), $execution->getResult());
4848
$this->assertGreaterThan(0, $execution->getDuration());
4949
$this->assertGreaterThanOrEqual($execution->getStartTime(), $execution->getEndTime());

0 commit comments

Comments
 (0)