Skip to content

Commit 0d248ad

Browse files
wachterjohannesalexander-schranz
authored andcommitted
Added error-output as message for seperate-process exception (#45)
* added error-output as message for seperate-process exception * fixed code-style
1 parent 89eb247 commit 0d248ad

File tree

7 files changed

+12
-9
lines changed

7 files changed

+12
-9
lines changed

src/Command/ScheduleTaskCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080

8181
$taskBuilder = $this->scheduler->createTask($handlerClass, $workload);
8282

83-
if ($cronExpression !== null) {
83+
if (null !== $cronExpression) {
8484
$endDate = null;
85-
if ($endDateString !== null) {
85+
if (null !== $endDateString) {
8686
$endDate = new \DateTime($endDateString);
8787
}
8888

8989
$taskBuilder->cron($cronExpression, new \DateTime(), $endDate);
9090
}
9191

92-
if ($executionDateString !== null) {
92+
if (null !== $executionDateString) {
9393
$taskBuilder->executeAt(new \DateTime($executionDateString));
9494
}
9595

src/DependencyInjection/HandlerCompilerPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
class HandlerCompilerPass implements CompilerPassInterface
2222
{
2323
const REGISTRY_ID = 'task.handler.factory';
24+
2425
const HANDLER_TAG = 'task.handler';
2526

2627
/**

src/Executor/SeparateProcessException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class SeparateProcessException extends \Exception
2626
*/
2727
public function __construct($errorOutput)
2828
{
29+
parent::__construct($errorOutput);
30+
2931
$this->errorOutput = $errorOutput;
3032
}
3133

src/Executor/SeparateProcessExecutor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private function handle(TaskExecutionInterface $execution)
131131
*/
132132
private function createException($errorOutput)
133133
{
134-
if (strpos($errorOutput, FailedException::class) !== 0) {
134+
if (0 !== strpos($errorOutput, FailedException::class)) {
135135
return new SeparateProcessException($errorOutput);
136136
}
137137

tests/Functional/Command/ScheduleSystemTasksCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ScheduleSystemTasksCommandTest extends BaseCommandTestCase
1010
public function setUp()
1111
{
1212
self::bootKernel();
13-
if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') {
13+
if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) {
1414
return $this->markTestSkipped('This testcase will only be called for doctrine storage.');
1515
}
1616

tests/Functional/Entity/TaskRepositoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function setUp()
2121

2222
public function testFindBySystemKey()
2323
{
24-
if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') {
24+
if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) {
2525
return $this->markTestSkipped('This testcase will only be called for doctrine storage.');
2626
}
2727

@@ -36,7 +36,7 @@ public function testFindBySystemKey()
3636

3737
public function testFindBySystemKeyNotFound()
3838
{
39-
if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') {
39+
if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) {
4040
return $this->markTestSkipped('This testcase will only be called for doctrine storage.');
4141
}
4242

@@ -48,7 +48,7 @@ public function testFindBySystemKeyNotFound()
4848

4949
public function testFindSystemTasks()
5050
{
51-
if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') {
51+
if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) {
5252
return $this->markTestSkipped('This testcase will only be called for doctrine storage.');
5353
}
5454

tests/app/TestKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function registerBundles()
4444
public function registerContainerConfiguration(LoaderInterface $loader)
4545
{
4646
$this->storage = getenv(self::STORAGE_VAR_NAME);
47-
if ($this->storage === false) {
47+
if (false === $this->storage) {
4848
$this->storage = 'array';
4949
}
5050

0 commit comments

Comments
 (0)