diff --git a/tests/PyzTest/Glue/Checkout/RestApi/Fixtures/ServicePointShipmentTypeCheckoutDataRestApiFixtures.php b/tests/PyzTest/Glue/Checkout/RestApi/Fixtures/ServicePointShipmentTypeCheckoutDataRestApiFixtures.php index d6cd631cb5..5a70cedbbd 100644 --- a/tests/PyzTest/Glue/Checkout/RestApi/Fixtures/ServicePointShipmentTypeCheckoutDataRestApiFixtures.php +++ b/tests/PyzTest/Glue/Checkout/RestApi/Fixtures/ServicePointShipmentTypeCheckoutDataRestApiFixtures.php @@ -137,7 +137,7 @@ public function buildFixtures(CheckoutApiTester $I): FixturesContainerInterface ShipmentMethodDataHelper::DEFAULT_PRICE_LIST, [$storeTransfer->getIdStoreOrFail()], ); - $I->addShipmentTypeToShipmentMethod($this->pickableShipmentMethodTransfer, $I->havePickableShipmentType()); + $I->addShipmentTypeToShipmentMethod($this->pickableShipmentMethodTransfer, $I->havePickableShipmentType($storeTransfer)); $this->nonPickableShipmentMethodTransfer = $I->haveShipmentMethod( [ diff --git a/tests/PyzTest/Glue/Checkout/_support/CheckoutApiTester.php b/tests/PyzTest/Glue/Checkout/_support/CheckoutApiTester.php index 4ce8d3be86..1fccde9da2 100644 --- a/tests/PyzTest/Glue/Checkout/_support/CheckoutApiTester.php +++ b/tests/PyzTest/Glue/Checkout/_support/CheckoutApiTester.php @@ -602,19 +602,25 @@ public function havePaymentMethodWithStore( } /** + * @param \Generated\Shared\Transfer\StoreTransfer $storeTransfer + * * @return \Generated\Shared\Transfer\ShipmentTypeTransfer */ - public function havePickableShipmentType(): ShipmentTypeTransfer + public function havePickableShipmentType(StoreTransfer $storeTransfer): ShipmentTypeTransfer { $shipmentTypeEntity = SpyShipmentTypeQuery::create() ->filterByKey(static::SHIPMENT_TYPE_KEY_PICKUP) - ->findOneOrCreate(); - if ($shipmentTypeEntity->isNew()) { - $shipmentTypeEntity->setName(ucfirst(static::SHIPMENT_TYPE_KEY_PICKUP)); - $shipmentTypeEntity->save(); + ->findOne(); + + if ($shipmentTypeEntity !== null) { + return (new ShipmentTypeTransfer())->fromArray($shipmentTypeEntity->toArray()); } - return (new ShipmentTypeTransfer())->fromArray($shipmentTypeEntity->toArray()); + return $this->haveShipmentType([ + ShipmentTypeTransfer::IS_ACTIVE => true, + ShipmentTypeTransfer::KEY => static::SHIPMENT_TYPE_KEY_PICKUP, + ShipmentTypeTransfer::STORE_RELATION => (new StoreRelationTransfer())->addStores($storeTransfer), + ]); } /**