Skip to content

Commit 2172826

Browse files
committed
Bump deps
1 parent dbfefe0 commit 2172826

File tree

3 files changed

+14
-37
lines changed

3 files changed

+14
-37
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
],
1313
"require": {
1414
"php": "~8.3.0 || ~8.4.0",
15-
"job-runner/job-runner": "^1.4",
15+
"job-runner/job-runner": "^1.5",
1616
"symfony/console": "^5.0 || ^6.0 || ^7.0"
1717
},
1818
"require-dev": {
1919
"doctrine/coding-standard": "^14.0",
20-
"phpstan/phpstan": "^2.1.29",
21-
"phpunit/phpunit": "^12.3.15"
20+
"phpstan/phpstan": "^2.1.31",
21+
"phpunit/phpunit": "^12.4.2"
2222
},
2323
"autoload": {
2424
"psr-4": {

phpunit.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
cacheDirectory=".phpunit.cache"
7+
displayDetailsOnAllIssues="true">
38
<coverage/>
49
<testsuites>
510
<testsuite name="Unit">

tests/Unit/SymfonyConsoleEventListenerTest.php

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,28 @@
44

55
namespace JobRunner\JobRunner\SymfonyConsole\Tests\Unit;
66

7-
use DateTimeImmutable;
87
use JobRunner\JobRunner\Job\Job;
98
use JobRunner\JobRunner\SymfonyConsole\SymfonyConsoleEventListener;
109
use PHPUnit\Framework\Attributes\CoversClass;
1110
use PHPUnit\Framework\TestCase;
12-
use RuntimeException;
1311
use Symfony\Component\Console\Helper\Table;
1412
use Symfony\Component\Console\Output\ConsoleSectionOutput;
1513

16-
use function array_key_exists;
17-
1814
#[CoversClass(SymfonyConsoleEventListener::class)]
1915
class SymfonyConsoleEventListenerTest extends TestCase
2016
{
21-
/** @var array<string, int> */
22-
private array $matcher = [];
23-
24-
private function getNextIncrement(string $name): int
25-
{
26-
if (! array_key_exists($name, $this->matcher)) {
27-
$this->matcher[$name] = 0;
28-
}
29-
30-
$this->matcher[$name]++;
31-
32-
return $this->matcher[$name];
33-
}
34-
3517
public function testSuccess(): void
3618
{
37-
$table = self::createMock(Table::class);
38-
$consoleSectionOutput = self::createMock(ConsoleSectionOutput::class);
39-
$job = self::createMock(Job::class);
40-
$nextHour = (new DateTimeImmutable())->setTime((int) (new DateTimeImmutable())->modify('+1 hour')->format('H'), 0, 0);
19+
$table = $this->createMock(Table::class);
20+
$consoleSectionOutput = $this->createMock(ConsoleSectionOutput::class);
21+
$job = $this->createMock(Job::class);
4122

42-
$table->expects($this->exactly(5))->method('render');
4323
$job->expects($this->any())->method('getName')->willReturn('myName');
4424
$job->expects($this->any())->method('getCronExpression')->willReturn('0 * * * *');
4525
$consoleSectionOutput->expects($this->exactly(5))->method('clear');
26+
$table->expects($this->exactly(5))->method('render');
4627
$table->expects($this->once())->method('setHeaders')->with(['Job name', 'cron expression', 'next run date', 'state', 'output']);
47-
$table->expects($this->exactly(5))->method('setRows')->with($this->callback(function (mixed $param) use ($nextHour) {
48-
return $param === match ($this->getNextIncrement('setRows')) {
49-
1 => [['myName', '0 * * * *', $nextHour->format('Y-m-d H:i:s'), 'start', null]],
50-
2 => [['myName', '0 * * * *', $nextHour->format('Y-m-d H:i:s'), 'fail', 'toto']],
51-
3 => [['myName', '0 * * * *', $nextHour->format('Y-m-d H:i:s'), 'notDue', null]],
52-
4 => [['myName', '0 * * * *', $nextHour->format('Y-m-d H:i:s'), 'isLocked', null]],
53-
5 => [['myName', '0 * * * *', $nextHour->format('Y-m-d H:i:s'), 'success', 'toto']],
54-
default => throw new RuntimeException()
55-
};
56-
}));
28+
$table->expects($this->exactly(5))->method('setRows');
5729

5830
$sUT = new SymfonyConsoleEventListener($consoleSectionOutput, $table);
5931

0 commit comments

Comments
 (0)