Skip to content

Commit

Permalink
[All] fix phpunit 10 depreration about name argument in data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoiriert committed Apr 23, 2024
1 parent 32761d2 commit 13f6f51
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 71 deletions.
16 changes: 8 additions & 8 deletions packages/cron-job/Tests/Command/QueueDueCronJobsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,41 +121,41 @@ public function testExecute(array $rawCronJobs, array $expectedDisplay): void
public static function provideDataForTestExecute(): iterable
{
yield [
'$rawCronJobs' => [],
'$expectedDisplay' => [],
'rawCronJobs' => [],
'expectedDisplay' => [],
];

yield [
'$rawCronJobs' => [
'rawCronJobs' => [
['name' => 'CronJob1', 'due' => true],
['name' => 'CronJob2', 'due' => false],
['name' => 'CronJob3', 'due' => true],
],
'$expectedDisplay' => [
'expectedDisplay' => [
'! [NOTE] Queueing cron job "CronJob1"...',
'! [NOTE] Queueing cron job "CronJob3"...',
],
];

yield [
'$rawCronJobs' => [
'rawCronJobs' => [
['name' => 'CronJob1', 'due' => false],
['name' => 'CronJob2', 'due' => false],
['name' => 'CronJob3', 'due' => false],
['name' => 'CronJob4', 'due' => false],
],
'$expectedDisplay' => [],
'expectedDisplay' => [],
];

yield [
'$rawCronJobs' => [
'rawCronJobs' => [
['name' => 'CronJob1', 'due' => true],
['name' => 'CronJob2', 'due' => true],
['name' => 'CronJob3', 'due' => true],
['name' => 'CronJob4', 'due' => true],
['name' => 'CronJob5', 'due' => false],
],
'$expectedDisplay' => [
'expectedDisplay' => [
'! [NOTE] Queueing cron job "CronJob1"...',
'! [NOTE] Queueing cron job "CronJob2"...',
'! [NOTE] Queueing cron job "CronJob3"...',
Expand Down
16 changes: 8 additions & 8 deletions packages/cron-job/Tests/CronJobProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public function testQueue(bool $force): void

public static function provideDataForTestQueue(): iterable
{
yield 'normal' => ['$force' => false];
yield 'normal' => ['force' => false];

yield 'forced' => ['$force' => true];
yield 'forced' => ['force' => true];
}

#[DataProvider('provideDataForTestProcess')]
Expand Down Expand Up @@ -161,15 +161,15 @@ public function testProcess(
public static function provideDataForTestProcess(): iterable
{
yield 'original command' => [
'$command' => 'bin/console draw:test:successfully',
'$overwrittenCommand' => null,
'$expectedProcessCommand' => 'bin/console draw:test:successfully',
'command' => 'bin/console draw:test:successfully',
'overwrittenCommand' => null,
'expectedProcessCommand' => 'bin/console draw:test:successfully',
];

yield 'overwritten command' => [
'$command' => $command = 'ls -lah %kernel.cache_dir%',
'$overwrittenCommand' => sprintf('%s | wc', $command),
'$expectedProcessCommand' => 'ls -lah /var/cache | wc',
'command' => $command = 'ls -lah %kernel.cache_dir%',
'overwrittenCommand' => sprintf('%s | wc', $command),
'expectedProcessCommand' => 'ls -lah /var/cache | wc',
];
}

Expand Down
70 changes: 35 additions & 35 deletions packages/cron-job/Tests/Entity/CronJobExecutionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,59 +39,59 @@ public function testIsExecutable(
public static function provideDataForTestIsExecutable(): iterable
{
yield 'inactive' => [
'$expectedExecutable' => false,
'$active' => false,
'$timeToLive' => 0,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'expectedExecutable' => false,
'active' => false,
'timeToLive' => 0,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
];

yield 'inactive-forced' => [
'$expectedExecutable' => true,
'$active' => false,
'$timeToLive' => 0,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'$now' => new \DateTimeImmutable('2024-04-17 01:00:00'),
'$forced' => true,
'expectedExecutable' => true,
'active' => false,
'timeToLive' => 0,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'now' => new \DateTimeImmutable('2024-04-17 01:00:00'),
'forced' => true,
];

yield 'active with no time to live' => [
'$expectedExecutable' => true,
'$active' => true,
'$timeToLive' => 0,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'$now' => new \DateTimeImmutable('2024-04-17 01:00:00'),
'expectedExecutable' => true,
'active' => true,
'timeToLive' => 0,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'now' => new \DateTimeImmutable('2024-04-17 01:00:00'),
];

yield 'inactive with no time to live' => [
'$expectedExecutable' => false,
'$active' => false,
'$timeToLive' => 0,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'$now' => new \DateTimeImmutable('2024-04-17 01:00:00'),
'expectedExecutable' => false,
'active' => false,
'timeToLive' => 0,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'now' => new \DateTimeImmutable('2024-04-17 01:00:00'),
];

yield 'active with exceeding time to live' => [
'$expectedExecutable' => false,
'$active' => true,
'$timeToLive' => 55,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'$now' => new \DateTimeImmutable('2024-04-17 00:00:59'),
'expectedExecutable' => false,
'active' => true,
'timeToLive' => 55,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'now' => new \DateTimeImmutable('2024-04-17 00:00:59'),
];

yield 'inactive with exceeding time to live' => [
'$expectedExecutable' => false,
'$active' => false,
'$timeToLive' => 120,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'$now' => new \DateTimeImmutable('2024-04-17 00:00:59'),
'expectedExecutable' => false,
'active' => false,
'timeToLive' => 120,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'now' => new \DateTimeImmutable('2024-04-17 00:00:59'),
];

yield 'active with time to live' => [
'$expectedExecutable' => true,
'$active' => true,
'$timeToLive' => 180,
'$requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'$now' => new \DateTimeImmutable('2024-04-17 00:02:59'),
'expectedExecutable' => true,
'active' => true,
'timeToLive' => 180,
'requestedAt' => new \DateTimeImmutable('2024-04-17 00:00:00'),
'now' => new \DateTimeImmutable('2024-04-17 00:02:59'),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -270,35 +270,35 @@ function (BrokerStartedEvent $event) use ($concurrent): void {
public static function provideDataForTestExecuteWithAutoConcurrent(): iterable
{
yield 'integer multiplier' => [
'$numCpus' => 4,
'$processesPerCore' => 1.0,
'$minProcesses' => 2,
'$maxProcesses' => null,
'$concurrent' => 4,
'numCpus' => 4,
'processesPerCore' => 1.0,
'minProcesses' => 2,
'maxProcesses' => null,
'concurrent' => 4,
];

yield 'float multiplier' => [
'$numCpus' => 4,
'$processesPerCore' => 0.8,
'$minProcesses' => 1,
'$maxProcesses' => null,
'$concurrent' => 3,
'numCpus' => 4,
'processesPerCore' => 0.8,
'minProcesses' => 1,
'maxProcesses' => null,
'concurrent' => 3,
];

yield 'minimum processes' => [
'$numCpus' => 2,
'$processesPerCore' => 0.8,
'$minProcesses' => 5,
'$maxProcesses' => null,
'$concurrent' => 5,
'numCpus' => 2,
'processesPerCore' => 0.8,
'minProcesses' => 5,
'maxProcesses' => null,
'concurrent' => 5,
];

yield 'maximum processes' => [
'$numCpus' => 2,
'$processesPerCore' => 5,
'$minProcesses' => 1,
'$maxProcesses' => 1,
'$concurrent' => 1,
'numCpus' => 2,
'processesPerCore' => 5,
'minProcesses' => 1,
'maxProcesses' => 1,
'concurrent' => 1,
];
}
}

0 comments on commit 13f6f51

Please sign in to comment.