From 5bb7bee160b438cc175a5e407e2eba5fcfbe37cb Mon Sep 17 00:00:00 2001 From: Mark Ernst <33826576+Mark-Ernst@users.noreply.github.com> Date: Tue, 4 Apr 2023 11:12:19 +0200 Subject: [PATCH] fix: remove instabox from carrierfactory (#449) * fix: remove instabox * fix: tests * test: use existing dropoffpoint --------- Co-authored-by: joerivanveen --- src/Model/Carrier/CarrierFactory.php | 1 - .../CarrierConfigurationFactoryTest.php | 20 +++++++++---------- test/Services/DropOffPointServiceTest.php | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Model/Carrier/CarrierFactory.php b/src/Model/Carrier/CarrierFactory.php index 86d68f5e..bc83d7d8 100644 --- a/src/Model/Carrier/CarrierFactory.php +++ b/src/Model/Carrier/CarrierFactory.php @@ -16,7 +16,6 @@ class CarrierFactory CarrierBpost::class, CarrierDPD::class, CarrierPostNL::class, - CarrierInstabox::class, CarrierDHLForYou::class, CarrierDHLParcelConnect::class, CarrierDHLEuroplus::class diff --git a/test/Factory/Account/CarrierConfigurationFactoryTest.php b/test/Factory/Account/CarrierConfigurationFactoryTest.php index 86c23541..2910bbfc 100644 --- a/test/Factory/Account/CarrierConfigurationFactoryTest.php +++ b/test/Factory/Account/CarrierConfigurationFactoryTest.php @@ -27,20 +27,20 @@ public function provideCreateCarrierConfigurationData(): array // ], 'With existing dropoff point' => [ [ - 'carrier_id' => 5, + 'carrier_id' => 1, 'default_drop_off_point' => [ 'box_number' => null, 'cc' => 'NL', - 'city' => 'Arnhem', - 'location_code' => '73658f70-417a-48d2-82bb-291f3dccce93', - 'location_name' => 'Instabox', - 'number' => '24', - 'number_suffix' => 'K', - 'postal_code' => '6827DE', + 'city' => 'Hoofddorp', + 'location_code' => '217171', + 'location_name' => 'PostNL', + 'number' => '124', + 'number_suffix' => null, + 'postal_code' => '2132DM', 'region' => null, 'retail_network_id' => null, 'state' => null, - 'street' => 'Hondsstraat', + 'street' => 'Marktlaan', ], 'default_drop_off_point_identifier' => null, ], @@ -54,10 +54,10 @@ public function provideCreateCarrierConfigurationData(): array // ], 'From API' => [ [ - 'carrier_id' => 5, + 'carrier_id' => 1, 'configuration' => [ 'default_cutoff_time' => '09:30', - 'default_drop_off_point' => 'e9149b66-7bee-439b-bab0-7a5d92ddc519', + 'default_drop_off_point' => '217171', 'monday_cutoff_time' => '09:30', ], ], diff --git a/test/Services/DropOffPointServiceTest.php b/test/Services/DropOffPointServiceTest.php index a1879da8..6ea069f9 100644 --- a/test/Services/DropOffPointServiceTest.php +++ b/test/Services/DropOffPointServiceTest.php @@ -5,7 +5,7 @@ namespace MyParcelNL\Sdk\Test\Services; use Exception; -use MyParcelNL\Sdk\src\Model\Carrier\CarrierInstabox; +use MyParcelNL\Sdk\src\Model\Carrier\CarrierPostNL; use MyParcelNL\Sdk\src\Services\Web\DropOffPointWebService; use MyParcelNL\Sdk\Test\Bootstrap\TestCase; @@ -19,11 +19,11 @@ class DropOffPointServiceTest extends TestCase */ public function testGetDropOffPoint(): void { - $service = (new DropOffPointWebService(new CarrierInstabox()))->setApiKey($this->getApiKey()); - $result = $service->getDropOffPoint('e9149b66-7bee-439b-bab0-7a5d92ddc519'); + $service = (new DropOffPointWebService(new CarrierPostNL()))->setApiKey($this->getApiKey()); + $result = $service->getDropOffPoint('217171'); if ($result) { - self::assertEquals('e9149b66-7bee-439b-bab0-7a5d92ddc519', $result->getLocationCode()); + self::assertEquals('217171', $result->getLocationCode()); } else { throw new Exception('Not one drop off point returned for external identifier'); } @@ -37,7 +37,7 @@ public function testGetDropOffPoint(): void */ public function testGetDropOffPoints(): void { - $service = (new DropOffPointWebService(new CarrierInstabox()))->setApiKey($this->getApiKey()); + $service = (new DropOffPointWebService(new CarrierPostNL()))->setApiKey($this->getApiKey()); $dropOffPoints = $service->getDropOffPoints('6825ME'); self::assertNotEmpty($dropOffPoints->all(), 'No dropoff points found');