feat: upgrade phpunit to 12.5

This commit is contained in:
Björn Fromme committed 2026-08-31 09:31:00 +02:00
1 parent 010cfe56b2
commit bfad61f1dd
95 files changed
+1436 -1224

No files matched your search

+19 -10
View File
@@ -17,27 +17,29 @@ use App\Repository\Groups\ContingentDayRepository;
use App\Repository\Groups\ContingentSyncStateRepository;
use App\Service\ContingentSnapshotManager;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Stub;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
class ContingentSnapshotManagerTest extends TestCase
{
private ContingentsClient&MockObject $client;
private ContingentDayRepository&MockObject $dayRepository;
private ContingentSyncStateRepository&MockObject $syncStateRepository;
private EntityManagerInterface&MockObject $entityManager;
private ContingentsClient&Stub $client;
private ContingentDayRepository&Stub $dayRepository;
private ContingentSyncStateRepository&Stub $syncStateRepository;
private EntityManagerInterface&Stub $entityManager;
protected function setUp(): void
{
$this->client = $this->createMock(ContingentsClient::class);
$this->dayRepository = $this->createMock(ContingentDayRepository::class);
$this->syncStateRepository = $this->createMock(ContingentSyncStateRepository::class);
$this->entityManager = $this->createMock(EntityManagerInterface::class);
$this->client = $this->createStub(ContingentsClient::class);
$this->dayRepository = $this->createStub(ContingentDayRepository::class);
$this->syncStateRepository = $this->createStub(ContingentSyncStateRepository::class);
$this->entityManager = $this->createStub(EntityManagerInterface::class);
}
public function testAddsMissingDaysAndMarksSnapshotChanged(): void
{
$this->entityManager = $this->createMock(EntityManagerInterface::class);
$this->dayRepository->method('findByAccommodationAndDateRange')->willReturn([]);
$this->dayRepository->method('findStatusFingerprintParts')->willReturn(['2026-07-01:OK', '2026-07-02:BLOCKED']);
$this->client->method('getContingentCalendar')->willReturn($this->response([
@@ -58,6 +60,8 @@ class ContingentSnapshotManagerTest extends TestCase
public function testUpdatesChangedStatusAndRemovesVanishedDays(): void
{
$this->entityManager = $this->createMock(EntityManagerInterface::class);
$existing = [
'2026-07-01' => $this->day('2026-07-01', ContingentStatus::Ok),
'2026-07-02' => $this->day('2026-07-02', ContingentStatus::Ok),
@@ -104,6 +108,9 @@ class ContingentSnapshotManagerTest extends TestCase
public function testUpstreamFailureKeepsSnapshotAndRecordsError(): void
{
$this->dayRepository = $this->createMock(ContingentDayRepository::class);
$this->entityManager = $this->createMock(EntityManagerInterface::class);
$state = new ContingentSyncState($this->accommodation());
$this->syncStateRepository->method('findOneByAccommodation')->willReturn($state);
$this->client->method('getContingentCalendar')->willThrowException(new BpnConnectException('upstream down'));
@@ -121,6 +128,8 @@ class ContingentSnapshotManagerTest extends TestCase
public function testEmptyUpstreamResponseDoesNotWipeAPopulatedRange(): void
{
$this->entityManager = $this->createMock(EntityManagerInterface::class);
$state = new ContingentSyncState($this->accommodation());
$this->syncStateRepository->method('findOneByAccommodation')->willReturn($state);
$this->dayRepository->method('findByAccommodationAndDateRange')->willReturn([
@@ -193,7 +202,7 @@ class ContingentSnapshotManagerTest extends TestCase
$this->dayRepository,
$this->syncStateRepository,
$this->entityManager,
$this->createMock(LoggerInterface::class),
$this->createStub(LoggerInterface::class),
);
return $manager->sync(