apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -23,6 +23,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* @internal
*
* @coversNothing
*/
class CronJobDatabaseInteractionTest extends KernelTestCase
@@ -46,7 +47,7 @@ class CronJobDatabaseInteractionTest extends KernelTestCase
$entityManager = self::$container->get(EntityManagerInterface::class);
$entityManager->createQuery("DELETE " . CronJobExecution::class . ' cje WHERE cje.key LIKE :key')
$entityManager->createQuery('DELETE '.CronJobExecution::class.' cje WHERE cje.key LIKE :key')
->setParameter('key', 'test-with-data')
->execute();
}

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\Tests\Cron;
use ArrayObject;
use Chill\MainBundle\Cron\CronJobInterface;
use Chill\MainBundle\Cron\CronManager;
use Chill\MainBundle\Entity\CronJobExecution;
@@ -23,10 +22,10 @@ use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\NullLogger;
use function array_key_exists;
/**
* @internal
*
* @coversNothing
*/
final class CronManagerTest extends TestCase
@@ -43,16 +42,16 @@ final class CronManagerTest extends TestCase
$jobToExecute->run([])->shouldBeCalled();
$executions = [
['key' => $jobOld1->getKey(), 'lastStart' => new DateTimeImmutable('yesterday'), 'lastEnd' => new DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
['key' => $jobOld2->getKey(), 'lastStart' => new DateTimeImmutable('3 days ago'), 'lastEnd' => new DateTimeImmutable('36 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
['key' => $jobOld1->getKey(), 'lastStart' => new \DateTimeImmutable('yesterday'), 'lastEnd' => new \DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
['key' => $jobOld2->getKey(), 'lastStart' => new \DateTimeImmutable('3 days ago'), 'lastEnd' => new \DateTimeImmutable('36 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
// this is the oldest one
['key' => 'to-exec', 'lastStart' => new DateTimeImmutable('1 month ago'), 'lastEnd' => new DateTimeImmutable('10 days ago'), 'lastStatus' => CronJobExecution::SUCCESS],
['key' => 'to-exec', 'lastStart' => new \DateTimeImmutable('1 month ago'), 'lastEnd' => new \DateTimeImmutable('10 days ago'), 'lastStatus' => CronJobExecution::SUCCESS],
];
$cronManager = new CronManager(
$this->buildCronJobExecutionRepository($executions),
$this->buildEntityManager([]),
new ArrayObject([$jobOld1, $jobToExecute->reveal(), $jobOld2]),
new \ArrayObject([$jobOld1, $jobToExecute->reveal(), $jobOld2]),
new NullLogger()
);
@@ -68,13 +67,13 @@ final class CronManagerTest extends TestCase
$jobNeverExecuted->canRun(null)->willReturn(true);
$executions = [
['key' => $jobAlreadyExecuted->getKey(), 'lastStart' => new DateTimeImmutable('yesterday'), 'lastEnd' => new DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
['key' => $jobAlreadyExecuted->getKey(), 'lastStart' => new \DateTimeImmutable('yesterday'), 'lastEnd' => new \DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
];
$cronManager = new CronManager(
$this->buildCronJobExecutionRepository($executions),
$this->buildEntityManager([Argument::type(CronJobExecution::class)]),
new ArrayObject([$jobNeverExecuted->reveal(), $jobAlreadyExecuted]),
new \ArrayObject([$jobNeverExecuted->reveal(), $jobAlreadyExecuted]),
new NullLogger()
);
@@ -90,13 +89,13 @@ final class CronManagerTest extends TestCase
$jobNeverExecuted->canRun(null)->willReturn(true);
$executions = [
['key' => $jobAlreadyExecuted->getKey(), 'lastStart' => new DateTimeImmutable('yesterday'), 'lastEnd' => new DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
['key' => $jobAlreadyExecuted->getKey(), 'lastStart' => new \DateTimeImmutable('yesterday'), 'lastEnd' => new \DateTimeImmutable('1 hours ago'), 'lastStatus' => CronJobExecution::SUCCESS],
];
$cronManager = new CronManager(
$this->buildCronJobExecutionRepository($executions),
$this->buildEntityManager([Argument::type(CronJobExecution::class)]),
new ArrayObject([$jobAlreadyExecuted, $jobNeverExecuted->reveal()]),
new \ArrayObject([$jobAlreadyExecuted, $jobNeverExecuted->reveal()]),
new NullLogger()
);
@@ -116,11 +115,11 @@ final class CronManagerTest extends TestCase
$e = new CronJobExecution($exec['key']);
$e->setLastStart($exec['lastStart']);
if (array_key_exists('lastEnd', $exec)) {
if (\array_key_exists('lastEnd', $exec)) {
$e->setLastEnd($exec['lastEnd']);
}
if (array_key_exists('lastStatus', $exec)) {
if (\array_key_exists('lastStatus', $exec)) {
$e->setLastStatus($exec['lastStatus']);
}