feat: upgrade phpunit to 12.5
This commit is contained in:
@@ -71,18 +71,18 @@ class BpnSyncContingentsCommandTest extends TestCase
|
||||
$hotelCodes,
|
||||
);
|
||||
|
||||
$accommodationRepository = $this->createMock(AccommodationRepository::class);
|
||||
$accommodationRepository = $this->createStub(AccommodationRepository::class);
|
||||
$accommodationRepository->method('findAllWithCalendarCode')->willReturn($accommodations);
|
||||
|
||||
$manager = $this->createMock(ContingentSnapshotManager::class);
|
||||
$manager = $this->createStub(ContingentSnapshotManager::class);
|
||||
if ([] !== $results) {
|
||||
$manager->method('sync')->willReturnOnConsecutiveCalls(...$results);
|
||||
}
|
||||
|
||||
$command = new BpnSyncContingentsCommand(
|
||||
$accommodationRepository,
|
||||
$this->createMock(ContingentSyncStateRepository::class),
|
||||
$this->createMock(ContingentDayRepository::class),
|
||||
$this->createStub(ContingentSyncStateRepository::class),
|
||||
$this->createStub(ContingentDayRepository::class),
|
||||
$manager,
|
||||
new NullLogger(),
|
||||
);
|
||||
|
||||
@@ -27,12 +27,14 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
private TravelLoader $travelLoader;
|
||||
private TravelDataProvider $travelDataService;
|
||||
private TravelSnapshotManager $travelSnapshotService;
|
||||
private BpnXmlSnapshotRefreshManager $snapshotRefreshManager;
|
||||
private BpnXmlSyncManager $syncManager;
|
||||
private BpnXmlSyncCommand $command;
|
||||
private ?BpnXmlSyncCommand $command = null;
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (null === $this->command) {
|
||||
return;
|
||||
}
|
||||
|
||||
$release = new \ReflectionMethod($this->command, 'release');
|
||||
$release->setAccessible(true);
|
||||
$release->invoke($this->command);
|
||||
@@ -40,30 +42,30 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->xmlSource = $this->createMock(FilesystemOperator::class);
|
||||
$this->xmlExport = $this->createMock(FilesystemOperator::class);
|
||||
$this->xmlSource = $this->createStub(FilesystemOperator::class);
|
||||
$this->xmlExport = $this->createStub(FilesystemOperator::class);
|
||||
$this->cache = $this->createMock(TagAwareCacheInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->logger = $this->createStub(LoggerInterface::class);
|
||||
$this->travelLoader = $this->createMock(TravelLoader::class);
|
||||
$this->travelDataService = $this->createMock(TravelDataProvider::class);
|
||||
$this->travelSnapshotService = $this->createMock(TravelSnapshotManager::class);
|
||||
$this->snapshotRefreshManager = new BpnXmlSnapshotRefreshManager(
|
||||
$this->travelLoader,
|
||||
$this->travelDataService,
|
||||
$this->travelSnapshotService,
|
||||
$this->logger,
|
||||
);
|
||||
}
|
||||
|
||||
$this->syncManager = new BpnXmlSyncManager(
|
||||
$this->xmlSource,
|
||||
$this->xmlExport,
|
||||
$this->cache,
|
||||
$this->logger,
|
||||
);
|
||||
|
||||
$this->command = new BpnXmlSyncCommand(
|
||||
$this->syncManager,
|
||||
$this->snapshotRefreshManager,
|
||||
private function command(): BpnXmlSyncCommand
|
||||
{
|
||||
return $this->command ??= new BpnXmlSyncCommand(
|
||||
new BpnXmlSyncManager(
|
||||
$this->xmlSource,
|
||||
$this->xmlExport,
|
||||
$this->cache,
|
||||
$this->logger,
|
||||
),
|
||||
new BpnXmlSnapshotRefreshManager(
|
||||
$this->travelLoader,
|
||||
$this->travelDataService,
|
||||
$this->travelSnapshotService,
|
||||
$this->logger,
|
||||
),
|
||||
$this->logger,
|
||||
);
|
||||
}
|
||||
@@ -101,7 +103,7 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
->method('invalidateTags')
|
||||
->with(['xml-sync']);
|
||||
|
||||
$tester = new CommandTester($this->command);
|
||||
$tester = new CommandTester($this->command());
|
||||
$tester->execute([]);
|
||||
|
||||
$this->assertSame(Command::SUCCESS, $tester->getStatusCode());
|
||||
@@ -121,7 +123,7 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
$this->travelSnapshotService->expects($this->never())->method('purgeOrphanedFutureSnapshots');
|
||||
$this->cache->expects($this->never())->method('invalidateTags');
|
||||
|
||||
$tester = new CommandTester($this->command);
|
||||
$tester = new CommandTester($this->command());
|
||||
$tester->execute([]);
|
||||
|
||||
$this->assertSame(Command::SUCCESS, $tester->getStatusCode());
|
||||
@@ -129,6 +131,8 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
|
||||
public function testSnapshotSyncIsSkippedAndWarningLoggedWhenFileMapGenerationFails(): void
|
||||
{
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$newerTimestamp = "24.03.2026 12:00:00\nExport\n3 Dateien\n";
|
||||
$olderTimestamp = "24.03.2026 10:00:00\nExport\n3 Dateien\n";
|
||||
|
||||
@@ -153,7 +157,7 @@ class BpnXmlSyncCommandTest extends TestCase
|
||||
$this->travelSnapshotService->expects($this->never())->method('purgeOrphanedFutureSnapshots');
|
||||
$this->cache->expects($this->once())->method('invalidateTags')->with(['xml-sync']);
|
||||
|
||||
$tester = new CommandTester($this->command);
|
||||
$tester = new CommandTester($this->command());
|
||||
$tester->execute([]);
|
||||
|
||||
$this->assertSame(Command::SUCCESS, $tester->getStatusCode());
|
||||
|
||||
@@ -51,7 +51,7 @@ class DbAnonymizeCommandTest extends TestCase
|
||||
{
|
||||
return new DbAnonymizeCommand(
|
||||
$anonymizer,
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$environment,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class MailjetNewsletterWebhookCommandTest extends TestCase
|
||||
$mailjetApiClient,
|
||||
'https://my.ep-reisen.de',
|
||||
'secret',
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->createStub(LoggerInterface::class),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user