chore: update tests to adopt recent changes
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user