From be0c9d67bb11c1bf3b977acde0809d3f54f3e737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 3 Apr 2026 13:49:50 +0200 Subject: [PATCH] chore: update tests to adopt recent changes --- tests/Command/BpnXmlSyncCommandTest.php | 4 ++++ tests/Service/TravelSnapshotServiceTest.php | 26 --------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/tests/Command/BpnXmlSyncCommandTest.php b/tests/Command/BpnXmlSyncCommandTest.php index 1035b19..e5f294d 100644 --- a/tests/Command/BpnXmlSyncCommandTest.php +++ b/tests/Command/BpnXmlSyncCommandTest.php @@ -7,6 +7,7 @@ namespace App\Tests\Command; use App\BusProNet\XmlLoader\TravelLoader; use App\Command\BpnXmlSyncCommand; use App\Service\TravelDataService; +use App\Service\TravelSnapshotService; use League\Flysystem\DirectoryListing; use League\Flysystem\FilesystemOperator; use PHPUnit\Framework\TestCase; @@ -23,6 +24,7 @@ class BpnXmlSyncCommandTest extends TestCase private LoggerInterface $logger; private TravelLoader $travelLoader; private TravelDataService $travelDataService; + private TravelSnapshotService $travelSnapshotService; private BpnXmlSyncCommand $command; protected function tearDown(): void @@ -41,6 +43,7 @@ class BpnXmlSyncCommandTest extends TestCase $this->logger = $this->createMock(LoggerInterface::class); $this->travelLoader = $this->createMock(TravelLoader::class); $this->travelDataService = $this->createMock(TravelDataService::class); + $this->travelSnapshotService = $this->createMock(TravelSnapshotService::class); $this->command = new BpnXmlSyncCommand( $this->xmlSource, @@ -49,6 +52,7 @@ class BpnXmlSyncCommandTest extends TestCase $this->logger, $this->travelLoader, $this->travelDataService, + $this->travelSnapshotService, ); } diff --git a/tests/Service/TravelSnapshotServiceTest.php b/tests/Service/TravelSnapshotServiceTest.php index 5e365c6..230e822 100644 --- a/tests/Service/TravelSnapshotServiceTest.php +++ b/tests/Service/TravelSnapshotServiceTest.php @@ -223,32 +223,6 @@ class TravelSnapshotServiceTest extends TestCase $this->assertSame($travel, $result); } - public function testLoadTravelReturnsNullWhenDeserializerReturnsWrongType(): void - { - $payload = '{"id":100}'; - $snapshot = new TravelSnapshot(100, 200, $payload, hash('sha256', $payload)); - - $this->snapshotRepository - ->expects($this->once()) - ->method('findByDateAndHotel') - ->with(100, 200) - ->willReturn($snapshot); - - $this->serializer - ->expects($this->once()) - ->method('deserialize') - ->willReturn(new \stdClass()); - - $this->logger - ->expects($this->once()) - ->method('warning') - ->with('Snapshot payload deserialization returned unexpected type', $this->arrayHasKey('snapshotId')); - - $result = $this->service->loadTravel(100, 200); - - $this->assertNull($result); - } - public function testUpsertFromTravelSkipsWhenTravelIsIncomplete(): void { $travelNoId = new Travel();