refactor: split buspro ApiClient into domain clients

This commit is contained in:
fromme committed 2026-10-02 13:55:30 +02:00
1 parent 0a55544ca8
commit b755a6f43e
52 files changed
+805 -695

No files matched your search

+9 -9
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Tests\Service;
use App\BusProNet\ApiClient;
use App\BusProNet\Client\TravelClient;
use App\BusProNet\Model\Travel;
use App\BusProNet\XmlLoader\TravelLoader;
use App\Exception\TravelNotFoundException;
@@ -20,7 +20,7 @@ class TravelDataProviderTest extends TestCase
{
private ?TravelDataProvider $service = null;
private TravelLoader $travelLoader;
private ApiClient $apiClient;
private TravelClient $travelClient;
private CacheInterface $cache;
private LoggerInterface $logger;
private TravelSnapshotManager $travelSnapshotService;
@@ -30,7 +30,7 @@ class TravelDataProviderTest extends TestCase
protected function setUp(): void
{
$this->travelLoader = $this->createStub(TravelLoader::class);
$this->apiClient = $this->createStub(ApiClient::class);
$this->travelClient = $this->createStub(TravelClient::class);
$this->cache = $this->createStub(CacheInterface::class);
$this->logger = $this->createStub(LoggerInterface::class);
$this->travelSnapshotService = $this->createStub(TravelSnapshotManager::class);
@@ -42,7 +42,7 @@ class TravelDataProviderTest extends TestCase
{
return $this->service ??= new TravelDataProvider(
$this->travelLoader,
$this->apiClient,
$this->travelClient,
$this->cache,
$this->logger,
$this->travelSnapshotService,
@@ -144,7 +144,7 @@ class TravelDataProviderTest extends TestCase
public function testGetTravelDataFromApiSuccess(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->travelClient = $this->createMock(TravelClient::class);
$this->travelSnapshotService = $this->createMock(TravelSnapshotManager::class);
$this->travelLookupService = $this->createMock(TravelIndex::class);
$this->travelEnrichmentService = $this->createMock(TravelEnricher::class);
@@ -162,7 +162,7 @@ class TravelDataProviderTest extends TestCase
->with($dateId)
->willReturn($productId);
$this->apiClient
$this->travelClient
->expects($this->once())
->method('getTravelData')
->with($productId, $hotelId)
@@ -199,7 +199,7 @@ class TravelDataProviderTest extends TestCase
->method('mapDateIdToProductId')
->willReturn($productId);
$this->apiClient
$this->travelClient
->method('getTravelData')
->willReturn($travel);
@@ -221,7 +221,7 @@ class TravelDataProviderTest extends TestCase
public function testGetTravelDataFromApiCannotMapDateId(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->travelClient = $this->createMock(TravelClient::class);
$this->travelLookupService = $this->createMock(TravelIndex::class);
$dateId = 12345;
@@ -233,7 +233,7 @@ class TravelDataProviderTest extends TestCase
->with($dateId)
->willReturn(null);
$this->apiClient
$this->travelClient
->expects($this->never())
->method('getTravelData');