From f23bd51d07808c6b446ff77f3544a8eb7481db9c Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Tue, 21 Aug 2018 13:26:44 +0200 Subject: [PATCH] Make tests passing --- src/Handler/SetDefaultAddressHandler.php | 2 +- src/Resources/config/services.xml | 2 + .../config/services/actions/address_book.xml | 2 + .../config/services/actions/cart.xml | 2 + .../config/services/actions/checkout.xml | 2 + .../config/services/actions/customer.xml | 2 + .../config/services/actions/product.xml | 2 + .../config/services/actions/taxon.xml | 2 + src/Resources/config/services/factories.xml | 2 + src/Resources/config/services/handlers.xml | 2 + src/Resources/config/services/queries.xml | 2 + src/Resources/config/services/validators.xml | 2 + .../ProductCatalogViewRepository.php | 2 +- tests/Application/app/AppKernel.php | 2 +- tests/Application/app/config/config.yml | 5 -- .../AddressBookCreateAddressApiTest.php | 24 +++--- .../AddressBookRemoveAddressApiTest.php | 22 ++--- .../AddressBookSetDefaultAddressApiTest.php | 10 +-- tests/Controller/AddressBookShowApiTest.php | 6 +- .../AddressBookUpdateAddressApiTest.php | 24 ++---- tests/Controller/CartAddCouponShopApiTest.php | 25 +++--- tests/Controller/CartApiTest.php | 9 +- .../CartChangeItemQuantityApiTest.php | 41 ++++++--- tests/Controller/CartDropCartApiTest.php | 15 ++-- tests/Controller/CartPickupApiTest.php | 10 +-- tests/Controller/CartPutItemToCartApiTest.php | 83 +++++++++---------- .../Controller/CartPutItemsToCartApiTest.php | 12 +-- .../CartRemoveCouponShopApiTest.php | 12 ++- .../CartRemoveItemFromCartApiTest.php | 37 ++++++--- tests/Controller/CartSummarizeApiTest.php | 27 +++--- tests/Controller/CheckoutAddressApiTest.php | 12 +-- .../CheckoutChoosePaymentMethodApiTest.php | 7 +- .../CheckoutChooseShippingMethodApiTest.php | 6 +- .../CheckoutCompleteOrderApiTest.php | 24 ++---- ...ShowAvailablePaymentMethodsShopApiTest.php | 15 ++-- ...howAvailableShippingMethodsShopApiTest.php | 10 +-- tests/Controller/CheckoutSummarizeApiTest.php | 39 +++++---- tests/Controller/CustomerLoginApiTest.php | 4 +- tests/Controller/CustomerRegisterApiTest.php | 17 ++-- ...ustomerRequestPasswordResettingApiTest.php | 4 +- ...CustomerResendVerificationTokenApiTest.php | 4 +- .../CustomerResetPasswordApiTest.php | 4 +- .../CustomerUpdateCustomerApiTest.php | 12 +-- tests/Controller/CustomerVerifyApiTest.php | 4 +- .../LoggedInCustomerDetailsActionTest.php | 4 +- .../ProductAddReviewByCodeApiTest.php | 5 +- .../ProductAddReviewBySlugApiTest.php | 5 +- .../ProductShowCatalogByCodeApiTest.php | 8 +- .../ProductShowCatalogBySlugApiTest.php | 8 +- .../ProductShowDetailsByCodeApiTest.php | 12 +-- .../ProductShowDetailsBySlugApiTest.php | 14 ++-- tests/Controller/ProductShowLatestApiTest.php | 4 +- .../ProductShowReviewsByCodeApiTest.php | 4 +- .../ProductShowReviewsBySlugApiTest.php | 4 +- tests/Controller/TaxonShowDetailsApiTest.php | 6 +- tests/Controller/TaxonShowTreeApiTest.php | 4 +- .../ORM/coupon_based_promotion.yml | 6 +- tests/DataFixtures/ORM/customer.yml | 14 ++-- tests/DataFixtures/ORM/mug_review.yml | 4 +- tests/DataFixtures/ORM/payment.yml | 2 - tests/DataFixtures/ORM/shipping.yml | 3 - tests/DataFixtures/ORM/shop.yml | 50 ++++------- .../show_address_book_response.json | 6 +- ...dd_multiple_products_to_cart_response.json | 6 +- ...tions_multiple_times_to_cart_response.json | 2 +- ...ant_based_on_options_to_cart_response.json | 2 +- ...riant_multiple_times_to_cart_response.json | 2 +- .../add_product_variant_to_cart_response.json | 2 +- ...oduct_multiple_times_to_cart_response.json | 2 +- .../add_simple_product_to_cart_response.json | 2 +- ...upon_based_promotion_applied_response.json | 2 +- ...with_product_variant_summary_response.json | 4 +- ..._with_simple_product_summary_response.json | 2 +- ...with_product_variant_summary_response.json | 2 +- ..._with_simple_product_summary_response.json | 2 +- ...processed_cart_after_deleting_an_item.json | 2 +- .../checkout/cart_addressed_response.json | 2 +- ...shipping_and_billing_address_response.json | 2 +- .../cart_with_chosen_payment_response.json | 2 +- .../cart_with_chosen_shipment_response.json | 2 +- ..._shipment_with_per_item_rate_response.json | 2 +- ..._shipment_with_per_item_rate_response.json | 2 +- .../Expected/customer/update_customer.json | 16 ++-- ...uct_review_list_page_by_code_response.json | 2 +- ...uct_review_list_page_by_slug_response.json | 2 +- 85 files changed, 371 insertions(+), 408 deletions(-) diff --git a/src/Handler/SetDefaultAddressHandler.php b/src/Handler/SetDefaultAddressHandler.php index 1733956cc..ee21420d7 100644 --- a/src/Handler/SetDefaultAddressHandler.php +++ b/src/Handler/SetDefaultAddressHandler.php @@ -64,6 +64,6 @@ public function handle(SetDefaultAddress $setDefaultAddress): void private function assertCurrentUserIsOwner(AddressInterface $address, ShopUserInterface $user) { Assert::notNull($address->getCustomer(), 'Address is not associated with any user.'); - Assert::eq($address->getCustomer()->getId(), $user->getId(), 'Current user is not owner of this address.'); + Assert::eq($address->getCustomer()->getId(), $user->getCustomer()->getId(), 'Current user is not owner of this address.'); } } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index e4a588de9..650a2b4ce 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -20,6 +20,8 @@ + + diff --git a/src/Resources/config/services/actions/address_book.xml b/src/Resources/config/services/actions/address_book.xml index 5082a8e03..e15b11d21 100644 --- a/src/Resources/config/services/actions/address_book.xml +++ b/src/Resources/config/services/actions/address_book.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/actions/cart.xml b/src/Resources/config/services/actions/cart.xml index e4f6286ad..9eb4187cf 100644 --- a/src/Resources/config/services/actions/cart.xml +++ b/src/Resources/config/services/actions/cart.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/actions/checkout.xml b/src/Resources/config/services/actions/checkout.xml index 77a696fc7..b94d9bfc7 100644 --- a/src/Resources/config/services/actions/checkout.xml +++ b/src/Resources/config/services/actions/checkout.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/actions/customer.xml b/src/Resources/config/services/actions/customer.xml index 4b5990338..816f91e5a 100644 --- a/src/Resources/config/services/actions/customer.xml +++ b/src/Resources/config/services/actions/customer.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/actions/product.xml b/src/Resources/config/services/actions/product.xml index 436b084e4..1c73f2d30 100644 --- a/src/Resources/config/services/actions/product.xml +++ b/src/Resources/config/services/actions/product.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/actions/taxon.xml b/src/Resources/config/services/actions/taxon.xml index c0fe90423..9b9aaa4c3 100644 --- a/src/Resources/config/services/actions/taxon.xml +++ b/src/Resources/config/services/actions/taxon.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/factories.xml b/src/Resources/config/services/factories.xml index 40be97564..ec7e91cab 100644 --- a/src/Resources/config/services/factories.xml +++ b/src/Resources/config/services/factories.xml @@ -2,6 +2,8 @@ + + %sylius.shop_api.view.image.class% diff --git a/src/Resources/config/services/handlers.xml b/src/Resources/config/services/handlers.xml index 9e2c72ec8..a0ac2e8e8 100644 --- a/src/Resources/config/services/handlers.xml +++ b/src/Resources/config/services/handlers.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/queries.xml b/src/Resources/config/services/queries.xml index 85fd9b45b..7f812a7ff 100644 --- a/src/Resources/config/services/queries.xml +++ b/src/Resources/config/services/queries.xml @@ -2,6 +2,8 @@ + + diff --git a/src/Resources/config/services/validators.xml b/src/Resources/config/services/validators.xml index 5ea7af388..703159f61 100644 --- a/src/Resources/config/services/validators.xml +++ b/src/Resources/config/services/validators.xml @@ -2,6 +2,8 @@ + + diff --git a/src/ViewRepository/ProductCatalogViewRepository.php b/src/ViewRepository/ProductCatalogViewRepository.php index 8e0acad99..739ec93dd 100644 --- a/src/ViewRepository/ProductCatalogViewRepository.php +++ b/src/ViewRepository/ProductCatalogViewRepository.php @@ -112,7 +112,7 @@ private function getLocaleCode(?string $localeCode, ChannelInterface $channel): private function findByTaxon(TaxonInterface $taxon, ChannelInterface $channel, PaginatorDetails $paginatorDetails, string $localeCode): PageView { $queryBuilder = $this->productRepository->createShopListQueryBuilder($channel, $taxon, $localeCode); - $queryBuilder->addOrderBy('o.id'); + $queryBuilder->addOrderBy('productTaxon.position'); $pagerfanta = new Pagerfanta(new DoctrineORMAdapter($queryBuilder)); diff --git a/tests/Application/app/AppKernel.php b/tests/Application/app/AppKernel.php index 1df161056..d9bd6aa29 100644 --- a/tests/Application/app/AppKernel.php +++ b/tests/Application/app/AppKernel.php @@ -23,8 +23,8 @@ public function registerBundles(): array new \Sylius\ShopApiPlugin\ShopApiPlugin(), new \Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle(), - new \Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle(), new \Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle(), + new \Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle(), ]); return $bundles; diff --git a/tests/Application/app/config/config.yml b/tests/Application/app/config/config.yml index 1b5677eb0..8d6f145a0 100644 --- a/tests/Application/app/config/config.yml +++ b/tests/Application/app/config/config.yml @@ -69,8 +69,3 @@ swiftmailer: spool: type: file path: "%kernel.cache_dir%/spool" - -fidry_alice_data_fixtures: - default_purge_mode: no_purge - db_drivers: - doctrine_orm: true diff --git a/tests/Controller/AddressBookCreateAddressApiTest.php b/tests/Controller/AddressBookCreateAddressApiTest.php index 31164be58..073963cbe 100644 --- a/tests/Controller/AddressBookCreateAddressApiTest.php +++ b/tests/Controller/AddressBookCreateAddressApiTest.php @@ -24,9 +24,8 @@ final class AddressBookCreateAddressApiTest extends JsonApiTestCase */ public function it_allows_user_to_add_new_address_to_address_book() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml']); + $this->logInUser('oliver@queen.com', '123password'); $data = <<assertResponseCode($response, Response::HTTP_NO_CONTENT); /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = $this->get('sylius.repository.customer'); + $customerRepository = self::$container->get('sylius.repository.customer'); /** @var Customer $customer */ $customer = $customerRepository->findOneBy(['email' => 'oliver@queen.com']); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var AddressInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Kupreska 12']); @@ -66,9 +65,8 @@ public function it_allows_user_to_add_new_address_to_address_book() */ public function it_does_not_allow_user_to_add_new_address_to_address_book_without_passing_required_data() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml']); + $this->logInUser('oliver@queen.com', '123password'); $data = <<loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml']); + $this->logInUser('oliver@queen.com', '123password'); $data = <<loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml']); + $this->logInUser('oliver@queen.com', '123password'); $data = <<loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var AddressInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Kupreska']); @@ -46,10 +44,8 @@ public function it_deletes_address_from_address_book() */ public function it_returns_bad_request_exception_if_address_has_not_been_found() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); $this->client->request('DELETE', sprintf('/shop-api/address-book/-1'), [], [], self::$acceptAndContentTypeHeader); $response = $this->client->getResponse(); @@ -62,13 +58,11 @@ public function it_returns_bad_request_exception_if_address_has_not_been_found() */ public function it_validates_if_current_user_is_owner_of_address() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var AddressInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Vukovarska']); diff --git a/tests/Controller/AddressBookSetDefaultAddressApiTest.php b/tests/Controller/AddressBookSetDefaultAddressApiTest.php index f7abe0738..9f11bda2d 100644 --- a/tests/Controller/AddressBookSetDefaultAddressApiTest.php +++ b/tests/Controller/AddressBookSetDefaultAddressApiTest.php @@ -24,13 +24,11 @@ final class AddressBookSetDefaultAddressApiTest extends JsonApiTestCase */ public function it_sets_given_address_as_default() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var ResourceInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Kupreska']); @@ -39,7 +37,7 @@ public function it_sets_given_address_as_default() $this->assertResponseCode($response, Response::HTTP_NO_CONTENT); /** @var UserRepositoryInterface $userRepository */ - $userRepository = $this->get('sylius.repository.shop_user'); + $userRepository = self::$container->get('sylius.repository.shop_user'); /** @var ShopUser $address */ $shopUser = $userRepository->findOneBy(['username' => 'oliver@queen.com']); diff --git a/tests/Controller/AddressBookShowApiTest.php b/tests/Controller/AddressBookShowApiTest.php index 4bc262ef8..9bb965a56 100644 --- a/tests/Controller/AddressBookShowApiTest.php +++ b/tests/Controller/AddressBookShowApiTest.php @@ -17,10 +17,8 @@ final class AddressBookShowApiTest extends JsonApiTestCase */ public function it_shows_address_book() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); $this->client->request('GET', '/shop-api/address-book', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/AddressBookUpdateAddressApiTest.php b/tests/Controller/AddressBookUpdateAddressApiTest.php index 532d617ab..e621c6bd0 100644 --- a/tests/Controller/AddressBookUpdateAddressApiTest.php +++ b/tests/Controller/AddressBookUpdateAddressApiTest.php @@ -22,13 +22,11 @@ final class AddressBookUpdateAddressApiTest extends JsonApiTestCase */ public function it_updates_address_in_address_book() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var AddressInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Kupreska']); @@ -67,13 +65,11 @@ public function it_updates_address_in_address_book() */ public function it_does_not_allow_to_update_address_if_country_or_province_code_are_not_valid() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var AddressInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Kupreska']); @@ -102,13 +98,11 @@ public function it_does_not_allow_to_update_address_if_country_or_province_code_ */ public function it_does_not_allow_to_update_address_without_passing_required_data() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('address.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml', 'country.yml', 'address.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = $this->get('sylius.repository.address'); + $addressRepository = self::$container->get('sylius.repository.address'); /** @var AddressInterface $address */ $address = $addressRepository->findOneBy(['street' => 'Kupreska']); diff --git a/tests/Controller/CartAddCouponShopApiTest.php b/tests/Controller/CartAddCouponShopApiTest.php index 88270927c..cde0d3b99 100644 --- a/tests/Controller/CartAddCouponShopApiTest.php +++ b/tests/Controller/CartAddCouponShopApiTest.php @@ -19,13 +19,12 @@ final class CartAddCouponShopApiTest extends JsonApiTestCase */ public function it_allows_to_add_promotion_coupon_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('coupon_based_promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'coupon_based_promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -48,12 +47,12 @@ public function it_allows_to_add_promotion_coupon_to_the_cart() */ public function it_does_not_allow_to_add_promotion_if_coupon_is_not_specified() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -69,7 +68,7 @@ public function it_does_not_allow_to_add_promotion_if_coupon_is_not_specified() */ public function it_does_not_allow_to_add_promotion_code_if_cart_does_not_exists() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -118,13 +117,12 @@ public function it_does_not_allow_to_add_promotion_code_if_promotion_code_does_n */ public function it_does_not_allow_to_add_promotion_code_if_code_is_invalid() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('coupon_based_promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'coupon_based_promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -147,13 +145,12 @@ public function it_does_not_allow_to_add_promotion_code_if_code_is_invalid() */ public function it_does_not_allow_to_add_promotion_code_if_related_promotion_is_not_valid() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('coupon_based_promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'coupon_based_promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); diff --git a/tests/Controller/CartApiTest.php b/tests/Controller/CartApiTest.php index 1db574e87..c58d7eb14 100644 --- a/tests/Controller/CartApiTest.php +++ b/tests/Controller/CartApiTest.php @@ -16,7 +16,7 @@ final class CartApiTest extends JsonApiTestCase */ public function it_returns_not_found_exception_if_cart_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/estimated-shipping-cost', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -29,8 +29,7 @@ public function it_returns_not_found_exception_if_cart_has_not_been_found() */ public function it_calculates_estimated_shipping_cost_based_on_country() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('shipping.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'shipping.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -48,9 +47,7 @@ public function it_calculates_estimated_shipping_cost_based_on_country() */ public function it_calculates_estimated_shipping_cost_based_on_country_and_province() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; diff --git a/tests/Controller/CartChangeItemQuantityApiTest.php b/tests/Controller/CartChangeItemQuantityApiTest.php index 0190e4bef..4c1b1acdf 100644 --- a/tests/Controller/CartChangeItemQuantityApiTest.php +++ b/tests/Controller/CartChangeItemQuantityApiTest.php @@ -6,6 +6,8 @@ use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; +use Sylius\Component\Core\Model\OrderItemInterface; +use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\ShopApiPlugin\Command\PickupCart; use Sylius\ShopApiPlugin\Command\PutSimpleItemToCart; use Symfony\Component\HttpFoundation\Response; @@ -19,7 +21,7 @@ final class CartChangeItemQuantityApiTest extends JsonApiTestCase */ public function it_does_not_allow_to_change_quantity_if_cart_does_not_exists() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 3)); @@ -53,7 +55,7 @@ public function it_changes_item_quantity() "quantity": 5 } EOT; - $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/1', [], [], static::$acceptAndContentTypeHeader, $data); + $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/' . $this->getFirstOrderItemId($token), [], [], static::$acceptAndContentTypeHeader, $data); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/filled_cart_with_simple_product_summary_response', Response::HTTP_OK); @@ -64,12 +66,12 @@ public function it_changes_item_quantity() */ public function it_does_not_allow_to_set_quantity_lower_than_one() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 3)); @@ -79,7 +81,7 @@ public function it_does_not_allow_to_set_quantity_lower_than_one() "quantity": 0 } EOT; - $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/1', [], [], static::$acceptAndContentTypeHeader, $data); + $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/' . $this->getFirstOrderItemId($token), [], [], static::$acceptAndContentTypeHeader, $data); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/validation_quantity_lower_than_one_response', Response::HTTP_BAD_REQUEST); @@ -90,16 +92,16 @@ public function it_does_not_allow_to_set_quantity_lower_than_one() */ public function it_does_not_allow_to_change_quantity_without_quantity_defined() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 3)); - $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/1', [], [], static::$acceptAndContentTypeHeader); + $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/' . $this->getFirstOrderItemId($token), [], [], static::$acceptAndContentTypeHeader); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/validation_quantity_lower_than_one_response', Response::HTTP_BAD_REQUEST); @@ -110,12 +112,12 @@ public function it_does_not_allow_to_change_quantity_without_quantity_defined() */ public function it_does_not_allow_to_change_quantity_if_cart_item_does_not_exists() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -124,9 +126,22 @@ public function it_does_not_allow_to_change_quantity_if_cart_item_does_not_exist "quantity": 5 } EOT; - $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/1', [], [], static::$acceptAndContentTypeHeader, $data); + $this->client->request('PUT', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/420', [], [], static::$acceptAndContentTypeHeader, $data); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/validation_cart_item_not_exists_response', Response::HTTP_BAD_REQUEST); } + + private function getFirstOrderItemId(string $orderToken): string + { + /** @var OrderRepositoryInterface $orderRepository */ + $orderRepository = self::$container->get('sylius.repository.order'); + + $order = $orderRepository->findOneBy(['tokenValue' => $orderToken]); + + /** @var OrderItemInterface $orderItem */ + $orderItem = $order->getItems()->first(); + + return (string) $orderItem->getId(); + } } diff --git a/tests/Controller/CartDropCartApiTest.php b/tests/Controller/CartDropCartApiTest.php index 128df798c..e05936b57 100644 --- a/tests/Controller/CartDropCartApiTest.php +++ b/tests/Controller/CartDropCartApiTest.php @@ -23,7 +23,7 @@ final class CartDropCartApiTest extends JsonApiTestCase */ public function it_returns_not_found_exception_if_cart_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -41,12 +41,12 @@ public function it_returns_not_found_exception_if_cart_has_not_been_found() */ public function it_deletes_a_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -61,15 +61,12 @@ public function it_deletes_a_cart() */ public function it_returns_not_found_exception_if_order_is_in_different_state_then_cart() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -96,7 +93,7 @@ public function it_returns_not_found_exception_if_order_is_in_different_state_th $bus->handle(new ChoosePaymentMethod($token, 0, 'PBC')); /** @var OrderInterface $order */ - $order = $this->get('sylius.repository.order')->findOneBy(['tokenValue' => $token]); + $order = self::$container->get('sylius.repository.order')->findOneBy(['tokenValue' => $token]); $bus->handle(new CompleteOrder($token, 'sylius@example.com')); diff --git a/tests/Controller/CartPickupApiTest.php b/tests/Controller/CartPickupApiTest.php index f85ca3a18..07a327a11 100644 --- a/tests/Controller/CartPickupApiTest.php +++ b/tests/Controller/CartPickupApiTest.php @@ -18,7 +18,7 @@ final class CartPickupApiTest extends JsonApiTestCase */ public function it_creates_a_new_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -66,7 +66,7 @@ public function it_does_not_allow_to_create_a_new_cart_if_token_is_already_used( */ public function it_does_not_allow_to_create_a_new_cart_if_channel_does_not_exist() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('POST', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325', [], [], static::$acceptAndContentTypeHeader); diff --git a/tests/Controller/CartPutItemToCartApiTest.php b/tests/Controller/CartPutItemToCartApiTest.php index da10633e7..602276ba9 100644 --- a/tests/Controller/CartPutItemToCartApiTest.php +++ b/tests/Controller/CartPutItemToCartApiTest.php @@ -25,12 +25,12 @@ final class CartPutItemToCartApiTest extends JsonApiTestCase */ public function it_adds_a_product_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -51,12 +51,12 @@ public function it_adds_a_product_to_the_cart() */ public function it_increases_quantity_of_existing_item_if_the_same_product_is_added_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -78,12 +78,12 @@ public function it_increases_quantity_of_existing_item_if_the_same_product_is_ad */ public function it_validates_if_product_is_simple_during_add_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -104,12 +104,12 @@ public function it_validates_if_product_is_simple_during_add_simple_product() */ public function it_validates_if_quantity_is_larger_than_0_during_add_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -130,12 +130,12 @@ public function it_validates_if_quantity_is_larger_than_0_during_add_simple_prod */ public function it_converts_quantity_as_an_integer_and_adds_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -156,12 +156,12 @@ public function it_converts_quantity_as_an_integer_and_adds_simple_product() */ public function it_validates_if_product_code_is_defined_during_add_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -181,12 +181,12 @@ public function it_validates_if_product_code_is_defined_during_add_simple_produc */ public function it_validates_if_product_exists_during_add_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -207,7 +207,7 @@ public function it_validates_if_product_exists_during_add_simple_product() */ public function it_does_not_allow_to_add_product_if_cart_does_not_exists_during_add_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -229,15 +229,12 @@ public function it_does_not_allow_to_add_product_if_cart_does_not_exists_during_ */ public function it_does_not_allow_to_add_product_if_order_has_been_placed() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -264,7 +261,7 @@ public function it_does_not_allow_to_add_product_if_order_has_been_placed() $bus->handle(new ChoosePaymentMethod($token, 0, 'PBC')); /** @var OrderInterface $order */ - $order = $this->get('sylius.repository.order')->findOneBy(['tokenValue' => $token]); + $order = self::$container->get('sylius.repository.order')->findOneBy(['tokenValue' => $token]); $bus->handle(new CompleteOrder($token, 'sylius@example.com')); @@ -286,12 +283,12 @@ public function it_does_not_allow_to_add_product_if_order_has_been_placed() */ public function it_adds_a_product_variant_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -313,12 +310,12 @@ public function it_adds_a_product_variant_to_the_cart() */ public function it_increases_quantity_of_existing_item_if_the_same_variant_is_added_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -341,12 +338,12 @@ public function it_increases_quantity_of_existing_item_if_the_same_variant_is_ad */ public function it_validates_if_quantity_is_larger_than_0_during_add_variant_based_configurable_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -368,12 +365,12 @@ public function it_validates_if_quantity_is_larger_than_0_during_add_variant_bas */ public function it_converts_quantity_as_an_integer_and_adds_variant_based_configurable_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -395,12 +392,12 @@ public function it_converts_quantity_as_an_integer_and_adds_variant_based_config */ public function it_validates_if_product_code_is_defined_during_add_variant_based_configurable_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -421,12 +418,12 @@ public function it_validates_if_product_code_is_defined_during_add_variant_based */ public function it_validates_if_product_exists_during_add_variant_based_configurable_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -448,12 +445,12 @@ public function it_validates_if_product_exists_during_add_variant_based_configur */ public function it_validates_if_product_is_configurable_during_add_variant_based_configurable_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -475,12 +472,12 @@ public function it_validates_if_product_is_configurable_during_add_variant_based */ public function it_validates_if_product_variant_exist_during_add_variant_based_configurable_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -499,12 +496,12 @@ public function it_validates_if_product_variant_exist_during_add_variant_based_c public function it_throws_an_exception_if_product_variant_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -528,12 +525,12 @@ public function it_throws_an_exception_if_product_variant_has_not_been_found() */ public function it_adds_a_product_variant_based_on_options_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -558,12 +555,12 @@ public function it_adds_a_product_variant_based_on_options_to_the_cart() */ public function it_increases_quantity_of_existing_item_while_adding_the_same_product_variant_based_on_option_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = diff --git a/tests/Controller/CartPutItemsToCartApiTest.php b/tests/Controller/CartPutItemsToCartApiTest.php index bbb3467a1..dc08a9a86 100644 --- a/tests/Controller/CartPutItemsToCartApiTest.php +++ b/tests/Controller/CartPutItemsToCartApiTest.php @@ -18,12 +18,12 @@ final class CartPutItemsToCartApiTest extends JsonApiTestCase */ public function it_adds_a_product_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -59,12 +59,12 @@ public function it_adds_a_product_to_the_cart() */ public function it_does_nothing_if_any_of_requested_products_is_not_valid() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = @@ -100,12 +100,12 @@ public function it_does_nothing_if_any_of_requested_products_is_not_valid() */ public function it_shows_validation_error_for_proper_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $data = diff --git a/tests/Controller/CartRemoveCouponShopApiTest.php b/tests/Controller/CartRemoveCouponShopApiTest.php index 19aa4f063..a03fb2361 100644 --- a/tests/Controller/CartRemoveCouponShopApiTest.php +++ b/tests/Controller/CartRemoveCouponShopApiTest.php @@ -20,13 +20,12 @@ final class CartRemoveCouponShopApiTest extends JsonApiTestCase */ public function it_allows_to_remove_a_promotion_coupon_from_the_cart() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('coupon_based_promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'coupon_based_promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddCoupon($token, 'BANANAS')); @@ -43,13 +42,12 @@ public function it_allows_to_remove_a_promotion_coupon_from_the_cart() */ public function it_allows_to_remove_a_promotion_coupon_from_the_cart_even_if_it_does_not_exist() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('coupon_based_promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'coupon_based_promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -65,7 +63,7 @@ public function it_allows_to_remove_a_promotion_coupon_from_the_cart_even_if_it_ */ public function it_does_not_allow_to_add_promotion_code_if_cart_does_not_exists() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('DELETE', '/shop-api/carts/WRONGTOKEN/coupon', [], [], static::$acceptAndContentTypeHeader, null); diff --git a/tests/Controller/CartRemoveItemFromCartApiTest.php b/tests/Controller/CartRemoveItemFromCartApiTest.php index 75bb69473..e82d46bbe 100644 --- a/tests/Controller/CartRemoveItemFromCartApiTest.php +++ b/tests/Controller/CartRemoveItemFromCartApiTest.php @@ -6,6 +6,8 @@ use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; +use Sylius\Component\Core\Model\OrderItemInterface; +use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\ShopApiPlugin\Command\PickupCart; use Sylius\ShopApiPlugin\Command\PutSimpleItemToCart; use Sylius\ShopApiPlugin\Command\PutVariantBasedConfigurableItemToCart; @@ -18,16 +20,24 @@ final class CartRemoveItemFromCartApiTest extends JsonApiTestCase */ public function it_deletes_item() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 1)); - $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/1', [], [], ['ACCEPT' => 'application/json']); + /** @var OrderRepositoryInterface $orderRepository */ + $orderRepository = self::$container->get('sylius.repository.order'); + + $order = $orderRepository->findOneBy(['tokenValue' => $token]); + + /** @var OrderItemInterface $orderItem */ + $orderItem = $order->getItems()->first(); + + $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/' . $orderItem->getId(), [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/cart_after_deleting_an_item', Response::HTTP_OK); @@ -38,15 +48,15 @@ public function it_deletes_item() */ public function it_returns_not_found_exception_if_cart_item_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); - $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/1', [], [], ['ACCEPT' => 'application/json']); + $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/420', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/cart_item_has_not_been_found_response', Response::HTTP_BAD_REQUEST); @@ -57,18 +67,25 @@ public function it_returns_not_found_exception_if_cart_item_has_not_been_found() */ public function it_reprocesses_the_order_after_deleting_an_item() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 1)); $bus->handle(new PutVariantBasedConfigurableItemToCart($token, 'LOGAN_HAT_CODE', 'SMALL_RED_LOGAN_HAT_CODE', 10)); - $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/2', [], [], ['ACCEPT' => 'application/json']); + /** @var OrderRepositoryInterface $orderRepository */ + $orderRepository = self::$container->get('sylius.repository.order'); + + $order = $orderRepository->findOneBy(['tokenValue' => $token]); + + /** @var OrderItemInterface $orderItem */ + $orderItem = $order->getItems()->last(); + + $this->client->request('DELETE', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325/items/' . $orderItem->getId(), [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); $this->assertResponse($response, 'cart/reprocessed_cart_after_deleting_an_item', Response::HTTP_OK); diff --git a/tests/Controller/CartSummarizeApiTest.php b/tests/Controller/CartSummarizeApiTest.php index 9a8dfa317..7fa210168 100644 --- a/tests/Controller/CartSummarizeApiTest.php +++ b/tests/Controller/CartSummarizeApiTest.php @@ -20,12 +20,12 @@ final class CartSummarizeApiTest extends JsonApiTestCase */ public function it_shows_summary_of_an_empty_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $this->client->request('GET', '/shop-api/carts/' . $token, [], [], ['ACCEPT' => 'application/json']); @@ -39,7 +39,7 @@ public function it_shows_summary_of_an_empty_cart() */ public function it_returns_not_found_exception_if_cart_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/carts/SDAOSLEFNWU35H3QLI5325', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -52,12 +52,12 @@ public function it_returns_not_found_exception_if_cart_has_not_been_found() */ public function it_shows_summary_of_a_cart_filled_with_a_simple_product() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -72,12 +72,12 @@ public function it_shows_summary_of_a_cart_filled_with_a_simple_product() */ public function it_shows_summary_of_a_cart_filled_with_a_simple_product_in_different_language() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_DE')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -92,12 +92,12 @@ public function it_shows_summary_of_a_cart_filled_with_a_simple_product_in_diffe */ public function it_shows_summary_of_a_cart_filled_with_a_product_with_variant() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $variantWithOptions = @@ -134,12 +134,12 @@ public function it_shows_summary_of_a_cart_filled_with_a_product_with_variant() */ public function it_shows_summary_of_a_cart_filled_with_a_product_with_variant_in_different_language() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_DE')); $variantWithOptions = @@ -167,13 +167,12 @@ public function it_shows_summary_of_a_cart_filled_with_a_product_with_variant_in */ public function it_shows_summary_of_a_cart_with_coupon_applied() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('coupon_based_promotion.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'coupon_based_promotion.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddCoupon($token, 'BANANAS')); diff --git a/tests/Controller/CheckoutAddressApiTest.php b/tests/Controller/CheckoutAddressApiTest.php index 8bc2362ea..ab28ad663 100644 --- a/tests/Controller/CheckoutAddressApiTest.php +++ b/tests/Controller/CheckoutAddressApiTest.php @@ -27,12 +27,12 @@ public function it_does_not_allow_to_address_unexisting_order() */ public function it_allows_to_address_order_with_the_same_shipping_and_billing_address_with_province() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -62,12 +62,12 @@ public function it_allows_to_address_order_with_the_same_shipping_and_billing_ad */ public function it_allows_to_address_order_with_the_same_shipping_and_billing_address_without_province() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -96,12 +96,12 @@ public function it_allows_to_address_order_with_the_same_shipping_and_billing_ad */ public function it_allows_to_address_order_with_different_shipping_and_billing_address() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); diff --git a/tests/Controller/CheckoutChoosePaymentMethodApiTest.php b/tests/Controller/CheckoutChoosePaymentMethodApiTest.php index 7ca6fd0f9..499347b9b 100644 --- a/tests/Controller/CheckoutChoosePaymentMethodApiTest.php +++ b/tests/Controller/CheckoutChoosePaymentMethodApiTest.php @@ -20,15 +20,12 @@ final class CheckoutChoosePaymentMethodApiTest extends JsonApiTestCase */ public function it_allows_to_choose_payment_method() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( diff --git a/tests/Controller/CheckoutChooseShippingMethodApiTest.php b/tests/Controller/CheckoutChooseShippingMethodApiTest.php index 01a0d3973..1f9ae431b 100644 --- a/tests/Controller/CheckoutChooseShippingMethodApiTest.php +++ b/tests/Controller/CheckoutChooseShippingMethodApiTest.php @@ -19,14 +19,12 @@ final class CheckoutChooseShippingMethodApiTest extends JsonApiTestCase */ public function it_allows_to_choose_shipping_method() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( diff --git a/tests/Controller/CheckoutCompleteOrderApiTest.php b/tests/Controller/CheckoutCompleteOrderApiTest.php index 69e1a08e1..6e549df82 100644 --- a/tests/Controller/CheckoutCompleteOrderApiTest.php +++ b/tests/Controller/CheckoutCompleteOrderApiTest.php @@ -21,15 +21,12 @@ final class CheckoutCompleteOrderApiTest extends JsonApiTestCase */ public function it_allows_to_complete_checkout() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -75,15 +72,12 @@ public function it_allows_to_complete_checkout() */ public function it_allows_to_complete_checkout_with_notes() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -130,16 +124,12 @@ public function it_allows_to_complete_checkout_with_notes() */ public function it_allows_to_complete_checkout_without_email_for_logged_in_customer() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); - $this->loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml', 'customer.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -169,7 +159,7 @@ public function it_allows_to_complete_checkout_without_email_for_logged_in_custo <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -42,12 +42,12 @@ public function it_does_not_provide_details_about_available_payment_method_befor public function it_does_not_provide_details_about_available_payment_method_before_choosing_shipping_method() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -83,15 +83,12 @@ public function it_does_not_provide_details_about_available_payment_method_befor */ public function it_provides_details_about_available_payment_method() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( diff --git a/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php b/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php index 171136e22..844022aa8 100644 --- a/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php +++ b/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php @@ -27,14 +27,12 @@ public function it_does_not_provide_details_about_available_shipping_method_for_ */ public function it_provides_details_about_available_shipping_method() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -66,12 +64,12 @@ public function it_provides_details_about_available_shipping_method() public function it_does_not_provide_details_about_available_shipping_method_before_addressing() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); diff --git a/tests/Controller/CheckoutSummarizeApiTest.php b/tests/Controller/CheckoutSummarizeApiTest.php index 1b26532e5..835515279 100644 --- a/tests/Controller/CheckoutSummarizeApiTest.php +++ b/tests/Controller/CheckoutSummarizeApiTest.php @@ -6,6 +6,8 @@ use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; +use Sylius\Component\Core\Model\OrderItemInterface; +use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\ShopApiPlugin\Command\AddressOrder; use Sylius\ShopApiPlugin\Command\ChooseShippingMethod; use Sylius\ShopApiPlugin\Command\PickupCart; @@ -22,12 +24,12 @@ final class CheckoutSummarizeApiTest extends JsonApiTestCase */ public function it_shows_an_order_with_same_shipping_and_billing_address_with_province() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -59,12 +61,12 @@ public function it_shows_an_order_with_same_shipping_and_billing_address_with_pr */ public function it_shows_an_order_with_different_shipping_and_billing_address_with_province() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); @@ -105,14 +107,12 @@ public function it_shows_an_order_with_different_shipping_and_billing_address_wi */ public function it_shows_an_order_with_chosen_shipment() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -157,14 +157,12 @@ public function it_shows_an_order_with_chosen_shipment() */ public function it_modifies_shipping_cost_when_changing_item_quantity() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( @@ -203,13 +201,21 @@ public function it_modifies_shipping_cost_when_changing_item_quantity() $response = $this->client->getResponse(); $this->assertResponse($response, 'checkout/cart_with_chosen_shipment_with_per_item_rate_response', Response::HTTP_OK); + /** @var OrderRepositoryInterface $orderRepository */ + $orderRepository = self::$container->get('sylius.repository.order'); + + $order = $orderRepository->findOneBy(['tokenValue' => $token]); + + /** @var OrderItemInterface $orderItem */ + $orderItem = $order->getItems()->first(); + $data = <<client->request('PUT', sprintf('/shop-api/carts/%s/items/1', $token), [], [], static::$acceptAndContentTypeHeader, $data); + $this->client->request('PUT', sprintf('/shop-api/carts/%s/items/%d', $token, $orderItem->getId()), [], [], static::$acceptAndContentTypeHeader, $data); $response = $this->client->getResponse(); $this->assertResponse($response, 'checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response', Response::HTTP_OK); @@ -220,15 +226,12 @@ public function it_modifies_shipping_cost_when_changing_item_quantity() */ public function it_shows_an_order_with_chosen_payment() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('country.yml'); - $this->loadFixturesFromFile('shipping.yml'); - $this->loadFixturesFromFile('payment.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'country.yml', 'shipping.yml', 'payment.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; /** @var CommandBus $bus */ - $bus = $this->get('tactician.commandbus'); + $bus = self::$container->get('tactician.commandbus'); $bus->handle(new PickupCart($token, 'WEB_GB')); $bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); $bus->handle(new AddressOrder( diff --git a/tests/Controller/CustomerLoginApiTest.php b/tests/Controller/CustomerLoginApiTest.php index 9908c9b18..03b260485 100644 --- a/tests/Controller/CustomerLoginApiTest.php +++ b/tests/Controller/CustomerLoginApiTest.php @@ -21,13 +21,13 @@ final class CustomerLoginApiTest extends JsonApiTestCase */ public function it_allows_to_log_customer_in() { - $this->loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['customer.yml']); $data = <<loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<assertResponseCode($response, Response::HTTP_NO_CONTENT); /** @var UserRepositoryInterface $userRepository */ - $userRepository = $this->get('sylius.repository.shop_user'); + $userRepository = self::$container->get('sylius.repository.shop_user'); $user = $userRepository->findOneByEmail('vinny@fandf.com'); Assert::assertNotNull($user); Assert::assertFalse($user->isEnabled()); /** @var EmailCheckerInterface $emailChecker */ - $emailChecker = $this->get('sylius.behat.email_checker'); + $emailChecker = self::$container->get('sylius.behat.email_checker'); Assert::assertTrue($emailChecker->hasRecipient('vinny@fandf.com')); } @@ -56,7 +56,7 @@ public function it_allows_to_register_in_shop_and_sends_a_verification_email_if_ */ public function it_allows_to_register_in_shop_and_automatically_enables_user_if_channel_does_not_require_verification() { - $this->loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<assertResponseCode($response, Response::HTTP_NO_CONTENT); /** @var UserRepositoryInterface $userRepository */ - $userRepository = $this->get('sylius.repository.shop_user'); + $userRepository = self::$container->get('sylius.repository.shop_user'); $user = $userRepository->findOneByEmail('vinny@fandf.com'); Assert::assertNotNull($user); Assert::assertTrue($user->isEnabled()); /** @var EmailCheckerInterface $emailChecker */ - $emailChecker = $this->get('sylius.behat.email_checker'); + $emailChecker = self::$container->get('sylius.behat.email_checker'); try { Assert::assertFalse($emailChecker->hasRecipient('vinny@fandf.com')); @@ -98,8 +98,7 @@ public function it_allows_to_register_in_shop_and_automatically_enables_user_if_ */ public function it_does_not_allow_to_register_in_shop_if_email_is_already_taken() { - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['customer.yml', 'channel.yml']); $data = <<loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['customer.yml']); $data = '{"email": "oliver@queen.com"}'; @@ -29,7 +29,7 @@ public function it_allows_to_reset_user_password() $this->assertResponseCode($response, Response::HTTP_NO_CONTENT); /** @var EmailCheckerInterface $emailChecker */ - $emailChecker = $this->get('sylius.behat.email_checker'); + $emailChecker = self::$container->get('sylius.behat.email_checker'); $this->assertTrue($emailChecker->hasRecipient('oliver@queen.com')); } diff --git a/tests/Controller/CustomerResendVerificationTokenApiTest.php b/tests/Controller/CustomerResendVerificationTokenApiTest.php index cb446bb11..d9a448f41 100644 --- a/tests/Controller/CustomerResendVerificationTokenApiTest.php +++ b/tests/Controller/CustomerResendVerificationTokenApiTest.php @@ -19,7 +19,7 @@ final class CustomerResendVerificationTokenApiTest extends JsonApiTestCase */ public function it_allows_to_resend_verification_token() { - $this->loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<assertResponseCode($response, Response::HTTP_CREATED); /** @var EmailCheckerInterface $emailChecker */ - $emailChecker = $this->get('sylius.behat.email_checker'); + $emailChecker = self::$container->get('sylius.behat.email_checker'); $this->assertSame(2, $emailChecker->countMessagesTo('vinny@fandf.com')); } diff --git a/tests/Controller/CustomerResetPasswordApiTest.php b/tests/Controller/CustomerResetPasswordApiTest.php index 2cb754bc8..13f8f1c33 100644 --- a/tests/Controller/CustomerResetPasswordApiTest.php +++ b/tests/Controller/CustomerResetPasswordApiTest.php @@ -20,14 +20,14 @@ final class CustomerResetPasswordApiTest extends JsonApiTestCase */ public function it_allows_to_verify_customer() { - $this->loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['customer.yml']); $data = '{"email": "oliver@queen.com"}'; $this->client->request('PUT', '/shop-api/request-password-reset', [], [], ['CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json'], $data); /** @var UserRepositoryInterface $userRepository */ - $userRepository = $this->get('sylius.repository.shop_user'); + $userRepository = self::$container->get('sylius.repository.shop_user'); /** @var ShopUserInterface $user */ $user = $userRepository->findOneByEmail('oliver@queen.com'); diff --git a/tests/Controller/CustomerUpdateCustomerApiTest.php b/tests/Controller/CustomerUpdateCustomerApiTest.php index 287b86b65..04efebcff 100644 --- a/tests/Controller/CustomerUpdateCustomerApiTest.php +++ b/tests/Controller/CustomerUpdateCustomerApiTest.php @@ -22,11 +22,11 @@ final class CustomerUpdateCustomerApiTest extends JsonApiTestCase */ public function it_updates_customer() { - $this->loadFixturesFromFile('customer.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml']); + $this->logInUser('oliver@queen.com', '123password'); /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = $this->get('sylius.repository.customer'); + $customerRepository = self::$container->get('sylius.repository.customer'); $data = <<loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['customer.yml']); $data = <<loadFixturesFromFile('customer.yml'); - $this->logInUser('oliver@queen.com', '123pa$$word'); + $this->loadFixturesFromFiles(['customer.yml']); + $this->logInUser('oliver@queen.com', '123password'); $data = <<loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<client->request('POST', '/shop-api/register', [], [], ['CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json'], $data); /** @var UserRepositoryInterface $userRepository */ - $userRepository = $this->get('sylius.repository.shop_user'); + $userRepository = self::$container->get('sylius.repository.shop_user'); $user = $userRepository->findOneByEmail('vinny@fandf.com'); $verifyEmail = sprintf('{"token": "%s"}', $user->getEmailVerificationToken()); diff --git a/tests/Controller/LoggedInCustomerDetailsActionTest.php b/tests/Controller/LoggedInCustomerDetailsActionTest.php index ff006439b..d9368170f 100644 --- a/tests/Controller/LoggedInCustomerDetailsActionTest.php +++ b/tests/Controller/LoggedInCustomerDetailsActionTest.php @@ -14,13 +14,13 @@ final class LoggedInCustomerDetailsActionTest extends JsonApiTestCase */ public function it_shows_currently_logged_in_customer_details() { - $this->loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['customer.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $data = <<loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'customer.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $data = <<loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'customer.yml']); $data = <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products/BRAND?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -27,7 +27,7 @@ public function it_shows_paginated_products_from_some_taxon_by_code() */ public function it_shows_products_for_sub_taxons_by_code() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products/WOMEN_T_SHIRTS?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -40,7 +40,7 @@ public function it_shows_products_for_sub_taxons_by_code() */ public function it_shows_paginated_products_from_some_taxon_by_code_in_different_language() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products/BRAND?channel=WEB_GB&locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -53,7 +53,7 @@ public function it_shows_paginated_products_from_some_taxon_by_code_in_different */ public function it_shows_second_page_of_paginated_products_from_some_taxon_by_code() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products/BRAND?channel=WEB_GB&limit=1&page=2', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/ProductShowCatalogBySlugApiTest.php b/tests/Controller/ProductShowCatalogBySlugApiTest.php index 1f085a56a..d6f3053ec 100644 --- a/tests/Controller/ProductShowCatalogBySlugApiTest.php +++ b/tests/Controller/ProductShowCatalogBySlugApiTest.php @@ -14,7 +14,7 @@ final class ProductShowCatalogBySlugApiTest extends JsonApiTestCase */ public function it_shows_paginated_products_from_some_taxon_by_slug() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products-by-slug/brands?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -27,7 +27,7 @@ public function it_shows_paginated_products_from_some_taxon_by_slug() */ public function it_shows_products_for_sub_taxons_by_slug() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products-by-slug/categories/t-shirts/women-t-shirts?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -40,7 +40,7 @@ public function it_shows_products_for_sub_taxons_by_slug() */ public function it_shows_paginated_products_from_some_taxon_by_slug_in_different_language() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products-by-slug/marken?channel=WEB_GB&locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -53,7 +53,7 @@ public function it_shows_paginated_products_from_some_taxon_by_slug_in_different */ public function it_shows_second_page_of_paginated_products_from_some_taxon_by_slug() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxon-products-by-slug/brands?channel=WEB_GB&limit=1&page=2', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/ProductShowDetailsByCodeApiTest.php b/tests/Controller/ProductShowDetailsByCodeApiTest.php index 3aafbbe1d..43f34219b 100644 --- a/tests/Controller/ProductShowDetailsByCodeApiTest.php +++ b/tests/Controller/ProductShowDetailsByCodeApiTest.php @@ -14,7 +14,7 @@ final class ProductShowDetailsByCodeApiTest extends JsonApiTestCase */ public function it_shows_simple_product_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products/LOGAN_MUG_CODE?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -38,7 +38,7 @@ public function it_throws_a_not_found_exception_if_channel_has_not_been_found() */ public function it_throws_a_not_found_exception_if_product_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products/WRONG_PRODUCT_CODE?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -51,7 +51,7 @@ public function it_throws_a_not_found_exception_if_product_has_not_been_found() */ public function it_shows_simple_product_details_page_in_different_locale() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products/LOGAN_MUG_CODE?channel=WEB_GB&locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -64,7 +64,7 @@ public function it_shows_simple_product_details_page_in_different_locale() */ public function it_shows_product_with_variant_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products/LOGAN_T_SHIRT_CODE?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -77,7 +77,7 @@ public function it_shows_product_with_variant_details_page() */ public function it_shows_product_with_options_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products/LOGAN_HAT_CODE?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -90,7 +90,7 @@ public function it_shows_product_with_options_details_page() */ public function it_shows_product_with_options_details_page_in_different_locale() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products/LOGAN_HAT_CODE?channel=WEB_GB&locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/ProductShowDetailsBySlugApiTest.php b/tests/Controller/ProductShowDetailsBySlugApiTest.php index 1d941b45c..eeb9168a9 100644 --- a/tests/Controller/ProductShowDetailsBySlugApiTest.php +++ b/tests/Controller/ProductShowDetailsBySlugApiTest.php @@ -14,7 +14,7 @@ final class ProductShowDetailsBySlugApiTest extends JsonApiTestCase */ public function it_shows_simple_product_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/logan-mug?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -27,7 +27,7 @@ public function it_shows_simple_product_details_page() */ public function it_shows_product_without_taxon_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/logan-shoes?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -51,7 +51,7 @@ public function it_throws_a_not_found_exception_if_channel_has_not_been_found() */ public function it_throws_a_not_found_exception_if_product_has_not_been_found() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/some-weird-stuff?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -64,7 +64,7 @@ public function it_throws_a_not_found_exception_if_product_has_not_been_found() */ public function it_shows_simple_product_details_page_in_different_locale() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/logan-becher?channel=WEB_GB&locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -77,7 +77,7 @@ public function it_shows_simple_product_details_page_in_different_locale() */ public function it_shows_product_with_variant_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/logan-t-shirt?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -90,7 +90,7 @@ public function it_shows_product_with_variant_details_page() */ public function it_shows_product_with_options_details_page() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/logan-hat?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -103,7 +103,7 @@ public function it_shows_product_with_options_details_page() */ public function it_shows_product_with_options_details_page_in_different_locale() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/products-by-slug/logan-hut?channel=WEB_GB&locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/ProductShowLatestApiTest.php b/tests/Controller/ProductShowLatestApiTest.php index d9dc4dc1f..8cf6c0d6a 100644 --- a/tests/Controller/ProductShowLatestApiTest.php +++ b/tests/Controller/ProductShowLatestApiTest.php @@ -14,7 +14,7 @@ final class ProductShowLatestApiTest extends JsonApiTestCase */ public function it_shows_latest_products_with_default_count() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/product-latest/', ['channel' => 'WEB_GB'], [], ['ACCEPT' => 'application/json']); @@ -28,7 +28,7 @@ public function it_shows_latest_products_with_default_count() */ public function it_shows_latest_2_products() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/product-latest/', ['channel' => 'WEB_GB', 'limit' => 2], [], ['ACCEPT' => 'application/json']); diff --git a/tests/Controller/ProductShowReviewsByCodeApiTest.php b/tests/Controller/ProductShowReviewsByCodeApiTest.php index 40b93beeb..d6513828a 100644 --- a/tests/Controller/ProductShowReviewsByCodeApiTest.php +++ b/tests/Controller/ProductShowReviewsByCodeApiTest.php @@ -14,9 +14,7 @@ final class ProductShowReviewsByCodeApiTest extends JsonApiTestCase */ public function it_shows_reviews_for_product_by_slug() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('mug_review.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'customer.yml', 'mug_review.yml']); $this->client->request('GET', '/shop-api/products/LOGAN_MUG_CODE/reviews?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/ProductShowReviewsBySlugApiTest.php b/tests/Controller/ProductShowReviewsBySlugApiTest.php index fb1097076..0e85bfba0 100644 --- a/tests/Controller/ProductShowReviewsBySlugApiTest.php +++ b/tests/Controller/ProductShowReviewsBySlugApiTest.php @@ -14,9 +14,7 @@ final class ProductShowReviewsBySlugApiTest extends JsonApiTestCase */ public function it_shows_reviews_for_product_by_slug() { - $this->loadFixturesFromFile('shop.yml'); - $this->loadFixturesFromFile('customer.yml'); - $this->loadFixturesFromFile('mug_review.yml'); + $this->loadFixturesFromFiles(['shop.yml', 'customer.yml', 'mug_review.yml']); $this->client->request('GET', '/shop-api/product-reviews-by-slug/logan-mug?channel=WEB_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/TaxonShowDetailsApiTest.php b/tests/Controller/TaxonShowDetailsApiTest.php index 11e28107f..dc6a26e71 100644 --- a/tests/Controller/TaxonShowDetailsApiTest.php +++ b/tests/Controller/TaxonShowDetailsApiTest.php @@ -14,7 +14,7 @@ final class TaxonShowDetailsApiTest extends JsonApiTestCase */ public function it_shows_summary_of_a_chosen_taxon() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxons/T_SHIRTS?locale=en_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -27,7 +27,7 @@ public function it_shows_summary_of_a_chosen_taxon() */ public function it_shows_summary_of_a_chosen_taxon_with_strange_code() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxons/de%3Flol%3Dxd%23boom?locale=en_GB', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); @@ -40,7 +40,7 @@ public function it_shows_summary_of_a_chosen_taxon_with_strange_code() */ public function it_shows_summary_of_a_chosen_taxon_in_different_language() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxons/T_SHIRTS?locale=de_DE', [], [], ['ACCEPT' => 'application/json']); $response = $this->client->getResponse(); diff --git a/tests/Controller/TaxonShowTreeApiTest.php b/tests/Controller/TaxonShowTreeApiTest.php index 4b3935abd..320530ff7 100644 --- a/tests/Controller/TaxonShowTreeApiTest.php +++ b/tests/Controller/TaxonShowTreeApiTest.php @@ -14,7 +14,7 @@ final class TaxonShowTreeApiTest extends JsonApiTestCase */ public function it_shows_tree_of_all_taxons() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxons/', [], [], ['ACCEPT' => 'application/json']); @@ -28,7 +28,7 @@ public function it_shows_tree_of_all_taxons() */ public function it_shows_tree_of_all_taxons_in_different_language() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $this->client->request('GET', '/shop-api/taxons/?locale=de_DE', [], [], ['ACCEPT' => 'application/json']); diff --git a/tests/DataFixtures/ORM/coupon_based_promotion.yml b/tests/DataFixtures/ORM/coupon_based_promotion.yml index f5d79e81c..19bec273d 100644 --- a/tests/DataFixtures/ORM/coupon_based_promotion.yml +++ b/tests/DataFixtures/ORM/coupon_based_promotion.yml @@ -5,16 +5,16 @@ Sylius\Component\Core\Model\Promotion: couponBased: true coupons: ["@bananas_coupon", "@used_banana_coupon"] channels: ["@gb_web_channel"] - actions: ["@10_percent_order_discount"] + actions: ["@10_percent_order_discount_1"] pineapple_promotion: code: "PINEAPPLE_PROMOTION" name: "Pineapple promotion" couponBased: true coupons: ["@pineapple_coupon"] - actions: ["@10_percent_order_discount"] + actions: ["@10_percent_order_discount_2"] Sylius\Component\Promotion\Model\PromotionAction: - 10_percent_order_discount: + 10_percent_order_discount_{1..2}: type: "order_percentage_discount" promotion: "@banana_promotion" configuration: diff --git a/tests/DataFixtures/ORM/customer.yml b/tests/DataFixtures/ORM/customer.yml index e74c46e0b..ffce3fa78 100644 --- a/tests/DataFixtures/ORM/customer.yml +++ b/tests/DataFixtures/ORM/customer.yml @@ -1,6 +1,6 @@ Sylius\Component\Core\Model\ShopUser: user_oliver: - plainPassword: "123pa$$word" + plainPassword: "123password" roles: ["ROLE_USER"] enabled: "true" customer: "@customer_oliver" @@ -8,12 +8,12 @@ Sylius\Component\Core\Model\ShopUser: usernameCanonical: "oliver@queen.com" user_hater: - plainPassword: "123pa$$word" - roles: ["ROLE_USER"] - enabled: "true" - customer: "@hater" - username: "hater@queen.com" - usernameCanonical: "hater@queen.com" + plainPassword: "123password" + roles: ["ROLE_USER"] + enabled: "true" + customer: "@hater" + username: "hater@queen.com" + usernameCanonical: "hater@queen.com" Sylius\Component\Core\Model\Customer: customer_oliver: diff --git a/tests/DataFixtures/ORM/mug_review.yml b/tests/DataFixtures/ORM/mug_review.yml index e0f51e178..97626e59c 100644 --- a/tests/DataFixtures/ORM/mug_review.yml +++ b/tests/DataFixtures/ORM/mug_review.yml @@ -1,12 +1,12 @@ Sylius\Component\Core\Model\ProductReview: - reviews_{1...20}: + reviews_{1..20}: title: "Nice mug" rating: "" author: "@customer_oliver" status: "accepted" comment: "" reviewSubject: "@mug" - bad_reviews_{1...5}: + bad_reviews_{1..5}: title: "Nice mug" rating: "" author: "@hater" diff --git a/tests/DataFixtures/ORM/payment.yml b/tests/DataFixtures/ORM/payment.yml index 9082b88f5..5e016ea6b 100644 --- a/tests/DataFixtures/ORM/payment.yml +++ b/tests/DataFixtures/ORM/payment.yml @@ -4,14 +4,12 @@ Sylius\Component\Core\Model\PaymentMethod: enabled: true gatewayConfig: '@offline' currentLocale: "en_GB" - currentTranslation: "@cash_on_delivery_translation" channels: ["@gb_web_channel"] pay_by_check: code: "PBC" enabled: true gatewayConfig: '@offline' currentLocale: "en_GB" - currentTranslation: "@pay_by_check_translation" channels: ["@gb_web_channel"] Sylius\Bundle\PayumBundle\Model\GatewayConfig: diff --git a/tests/DataFixtures/ORM/shipping.yml b/tests/DataFixtures/ORM/shipping.yml index 59ba726d9..1134e61b8 100644 --- a/tests/DataFixtures/ORM/shipping.yml +++ b/tests/DataFixtures/ORM/shipping.yml @@ -8,7 +8,6 @@ Sylius\Component\Core\Model\ShippingMethod: amount: 500 zone: "@zone_gb_scotland" currentLocale: "en_GB" - currentTranslation: "@ups_translation" translations: ["@ups_translation"] channels: ["@gb_web_channel"] dhl: @@ -20,7 +19,6 @@ Sylius\Component\Core\Model\ShippingMethod: amount: 1500 zone: "@zone_gb" currentLocale: "en_GB" - currentTranslation: "@dhl_translation" translations: ["@dhl_translation"] channels: ["@gb_web_channel"] fedEx: @@ -32,7 +30,6 @@ Sylius\Component\Core\Model\ShippingMethod: amount: 500 zone: "@zone_gb" currentLocale: "en_GB" - currentTranslation: "@fed_ex_translation" translations: ["@fed_ex_translation"] channels: ["@gb_web_channel"] diff --git a/tests/DataFixtures/ORM/shop.yml b/tests/DataFixtures/ORM/shop.yml index 40a7083ab..802cf1ed3 100644 --- a/tests/DataFixtures/ORM/shop.yml +++ b/tests/DataFixtures/ORM/shop.yml @@ -39,12 +39,10 @@ Sylius\Component\Core\Model\Product: code: "LOGAN_MUG_CODE" channels: ["@gb_web_channel"] currentLocale: "en_GB" - currentTranslation: "@en_gb_mug_product_translation" translations: ["@en_gb_mug_product_translation", "@de_de_mug_product_translation"] images: ["@mug_thumbnail"] mainTaxon: "@mug_taxon" productTaxons: ["@mug_product_taxon"] - association: ["@cross-sell-hat-association"] attributes: - "@en_gb_mug_holiday_collection_value" - "@de_de_mug_holiday_collection_value" @@ -54,7 +52,6 @@ Sylius\Component\Core\Model\Product: code: "LOGAN_T_SHIRT_CODE" channels: ["@gb_web_channel"] currentLocale: "en_GB" - currentTranslation: "@t_shirt_translation" images: ["@t_shirt_thumbnail", "@small_t_shirt_thumbnail", "@large_t_shirt_thumbnail"] mainTaxon: "@t_shirt_taxon" productTaxons: ["@women_t_shirt_product_taxon"] @@ -63,15 +60,14 @@ Sylius\Component\Core\Model\Product: channels: ["@gb_web_channel"] options: ["@hat_size"] currentLocale: "en_GB" - currentTranslation: "@en_gb_hat_product_translation" translations: ["@en_gb_hat_product_translation", "@de_de_hat_product_translation"] + associations: ["@cross-sell-hat-association"] mainTaxon: "@hat_taxon" productTaxons: ["@hat_product_taxon"] shoes: code: "LOGAN_SHOES_CODE" channels: ["@gb_web_channel"] currentLocale: "en_GB" - currentTranslation: "@en_gb_shoes_product_translation" translations: ["@en_gb_shoes_product_translation"] Sylius\Component\Core\Model\ProductTranslation: @@ -116,7 +112,6 @@ Sylius\Component\Core\Model\ProductVariant: code: "LOGAN_MUG_CODE" product: "@mug" currentLocale: "en_GB" - currentTranslation: "@en_gb_mug_variant_translation" translations: ["@en_gb_mug_variant_translation", "@de_de_mug_variant_translation"] channelPricings: WEB_GB: "@gb_mug_web_channel_pricing" @@ -125,7 +120,6 @@ Sylius\Component\Core\Model\ProductVariant: code: "SMALL_LOGAN_T_SHIRT_CODE" product: "@t_shirt" currentLocale: "en_GB" - currentTranslation: "@small_t_shirt_translation" channelPricings: WEB_GB: "@gb_small_t_shirt_web_channel_pricing" WEB_DE: "@de_small_t_shirt_web_channel_pricing" @@ -133,7 +127,6 @@ Sylius\Component\Core\Model\ProductVariant: code: "LARGE_LOGAN_T_SHIRT_CODE" product: "@t_shirt" currentLocale: "en_GB" - currentTranslation: "@large_t_shirt_translation" channelPricings: WEB_GB: "@gb_large_t_shirt_web_channel_pricing" WEB_DE: "@de_large_t_shirt_web_channel_pricing" @@ -142,7 +135,6 @@ Sylius\Component\Core\Model\ProductVariant: product: "@hat" currentLocale: "en_GB" optionValues: ["@hat_size_s", "@hat_color_red"] - currentTranslation: "@small_red_en_gb_hat_translation" translations: ["@small_red_en_gb_hat_translation", "@small_red_de_de_hat_translation"] channelPricings: WEB_GB: "@gb_small_red_hat_web_channel_pricing" @@ -152,7 +144,6 @@ Sylius\Component\Core\Model\ProductVariant: product: "@hat" optionValues: ["@hat_size_l", "@hat_color_red"] currentLocale: "en_GB" - currentTranslation: "@large_red_en_gb_hat_translation" translations: ["@large_red_en_gb_hat_translation"] channelPricings: WEB_GB: "@gb_large_red_hat_web_channel_pricing" @@ -162,7 +153,6 @@ Sylius\Component\Core\Model\ProductVariant: product: "@hat" currentLocale: "en_GB" optionValues: ["@hat_size_s", "@hat_color_blue"] - currentTranslation: "@small_blue_en_gb_hat_translation" translations: ["@small_blue_en_gb_hat_translation", "@small_blue_de_de_hat_translation"] channelPricings: WEB_GB: "@gb_small_blue_hat_web_channel_pricing" @@ -172,7 +162,6 @@ Sylius\Component\Core\Model\ProductVariant: product: "@hat" optionValues: ["@hat_size_l", "@hat_color_blue"] currentLocale: "en_GB" - currentTranslation: "@large_blue_en_gb_hat_translation" translations: ["@large_blue_en_gb_hat_translation", "@large_blue_de_de_hat_translation"] channelPricings: WEB_GB: "@gb_large_blue_hat_web_channel_pricing" @@ -273,13 +262,11 @@ Sylius\Component\Product\Model\ProductOption: currentLocale: "en_GB" fallbackLocale: "en_GB" code: "HAT_SIZE" - currentTranslation: "@en_gb_hat_size_translations" translations: ["@en_gb_hat_size_translations"] hat_color: currentLocale: "en_GB" fallbackLocale: "en_GB" code: "HAT_COLOR" - currentTranslation: "@en_gb_hat_color_translations" translations: ["@en_gb_hat_color_translations", "@de_de_hat_color_translations"] Sylius\Component\Product\Model\ProductOptionTranslation: @@ -302,28 +289,24 @@ Sylius\Component\Product\Model\ProductOptionValue: fallbackLocale: "en_GB" code: "HAT_SIZE_S" option: "@hat_size" - currentTranslation: "@en_gb_hat_size_s_translations" translations: ["@en_gb_hat_size_s_translations", "@de_de_hat_size_s_translations"] hat_size_l: currentLocale: "en_GB" fallbackLocale: "en_GB" code: "HAT_SIZE_L" option: "@hat_size" - currentTranslation: "@en_gb_hat_size_l_translations" translations: ["@en_gb_hat_size_l_translations", "@de_de_hat_size_l_translations"] hat_color_red: currentLocale: "en_GB" fallbackLocale: "en_GB" code: "HAT_COLOR_RED" option: "@hat_color" - currentTranslation: "@en_gb_hat_color_red_translations" translations: ["@en_gb_hat_color_red_translations", "@de_de_hat_color_red_translations"] hat_color_blue: currentLocale: "en_GB" fallbackLocale: "en_GB" code: "HAT_COLOR_BLUE" option: "@hat_color" - currentTranslation: "@en_gb_hat_color_blue_translations" translations: ["@en_gb_hat_color_blue_translations", "@de_de_hat_color_blue_translations"] Sylius\Component\Product\Model\ProductOptionValueTranslation: @@ -381,55 +364,45 @@ Sylius\Component\Core\Model\Taxon: category_taxon: code: "CATEGORY" currentLocale: "en_GB" - currentTranslation: "@en_gb_category_translation" translations: ["@en_gb_category_translation"] children: ["@mug_taxon", "@hat_taxon", "@t_shirt_taxon"] mug_taxon: code: "MUG" currentLocale: "en_GB" - currentTranslation: "@en_gb_mug_taxon_translation" translations: ["@en_gb_mug_taxon_translation", "@de_de_mug_taxon_translation"] parent: "@category_taxon" - root: "@category_taxon" + position: 0 hat_taxon: code: "HAT" currentLocale: "en_GB" - currentTranslation: "@en_gb_hat_translation" translations: ["@en_gb_hat_translation", "@de_de_hat_translation"] parent: "@category_taxon" - root: "@category_taxon" + position: 1 t_shirt_taxon: code: "T_SHIRTS" currentLocale: "en_GB" - currentTranslation: "@en_gb_t_shirt_taxon_translation" translations: ["@en_gb_t_shirt_taxon_translation", "@de_de_t_shirt_taxon_translation"] images: ["@t_shirt_taxon_thumbnail"] children: ["@men_t_shirt_taxon", "@women_t_shirt_taxon"] parent: "@category_taxon" - root: "@category_taxon" + position: 2 men_t_shirt_taxon: code: "MEN_T_SHIRTS" currentLocale: "en_GB" - currentTranslation: "@en_gb_men_t_shirt_translation" translations: ["@en_gb_men_t_shirt_translation", "@de_de_men_t_shirt_translation"] parent: "@t_shirt_taxon" - root: "@category_taxon" women_t_shirt_taxon: code: "WOMEN_T_SHIRTS" currentLocale: "en_GB" - currentTranslation: "@en_gb_women_t_shirt_translation" translations: ["@en_gb_women_t_shirt_translation", "@de_de_women_t_shirt_translation"] parent: "@t_shirt_taxon" - root: "@category_taxon" brand_taxon: code: "BRAND" currentLocale: "en_GB" - currentTranslation: "@en_gb_brand_translation" translations: ["@en_gb_brand_translation", "@de_de_brand_translation"] yet_another_taxon: code: "de?lol=xd#boom" currentLocale: "en_GB" - currentTranslation: "@en_gb_yet_another_taxon_translation" translations: ["@en_gb_yet_another_taxon_translation"] Sylius\Component\Taxonomy\Model\TaxonTranslation: @@ -520,21 +493,27 @@ Sylius\Component\Core\Model\ProductTaxon: mug_product_taxon: product: "@mug" taxon: "@mug_taxon" + position: 0 women_t_shirt_product_taxon: product: "@t_shirt" taxon: "@women_t_shirt_taxon" + position: 0 hat_product_taxon: product: "@hat" taxon: "@hat_taxon" + position: 0 mug_brand_taxon: product: "@mug" taxon: "@brand_taxon" + position: 0 t_shirt_brand_taxon: product: "@t_shirt" taxon: "@brand_taxon" + position: 1 hat_brand_taxon: product: "@hat" taxon: "@brand_taxon" + position: 2 Sylius\Component\Core\Model\TaxonImage: t_shirt_taxon_thumbnail: @@ -545,7 +524,6 @@ Sylius\Component\Product\Model\ProductAssociationType: cross-sell: code: "CROSS_SELL_ASSOCIATION_TYPE" currentLocale: "en_GB" - currentTranslation: "@en_gb_cross-sell_translation" Sylius\Component\Product\Model\ProductAssociationTypeTranslation: en_gb_cross-sell_translation: @@ -604,19 +582,19 @@ Sylius\Component\Product\Model\ProductAttributeValue: subject: "@mug" attribute: "@mug_collection" localeCode: "en_GB" - text: "HOLIDAY COLLECTION" + value: "HOLIDAY COLLECTION" de_de_mug_holiday_collection_value: subject: "@mug" attribute: "@mug_collection" localeCode: "de_DE" - text: "FEIERTAGSKOLLEKTION" + value: "FEIERTAGSKOLLEKTION" en_gb_mug_holiday_material_value: subject: "@mug" attribute: "@mug_material" localeCode: "en_GB" - text: "Wood" + value: "Wood" de_de_mug_holiday_material_value: subject: "@mug" attribute: "@mug_material" localeCode: "de_DE" - text: "Holz" + value: "Holz" diff --git a/tests/Responses/Expected/address_book/show_address_book_response.json b/tests/Responses/Expected/address_book/show_address_book_response.json index be53786fa..7269ecc21 100644 --- a/tests/Responses/Expected/address_book/show_address_book_response.json +++ b/tests/Responses/Expected/address_book/show_address_book_response.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "id": @integer@, "firstName": "Jeanie", "lastName": "Metz", "countryCode": "United Kingdom", @@ -13,7 +13,7 @@ "default": false }, { - "id": 2, + "id": @integer@, "firstName": "Jeanie", "lastName": "Metz", "countryCode": "United Kingdom", @@ -26,7 +26,7 @@ "default": false }, { - "id": 3, + "id": @integer@, "firstName": "Jeanie", "lastName": "Metz", "countryCode": "United Kingdom", diff --git a/tests/Responses/Expected/cart/add_multiple_products_to_cart_response.json b/tests/Responses/Expected/cart/add_multiple_products_to_cart_response.json index 12a716fa5..877ee2b4e 100644 --- a/tests/Responses/Expected/cart/add_multiple_products_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_multiple_products_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 3, "total": 5997, "product": { @@ -57,7 +57,7 @@ } }, { - "id": 2, + "id": @integer@, "quantity": 3, "total": 5997, "product": { @@ -110,7 +110,7 @@ } }, { - "id": 3, + "id": @integer@, "quantity": 3, "total": 1500, "product": { diff --git a/tests/Responses/Expected/cart/add_product_variant_based_on_options_multiple_times_to_cart_response.json b/tests/Responses/Expected/cart/add_product_variant_based_on_options_multiple_times_to_cart_response.json index 48f932007..23ac96f4c 100644 --- a/tests/Responses/Expected/cart/add_product_variant_based_on_options_multiple_times_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_product_variant_based_on_options_multiple_times_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 6, "total": 3000, "product": { diff --git a/tests/Responses/Expected/cart/add_product_variant_based_on_options_to_cart_response.json b/tests/Responses/Expected/cart/add_product_variant_based_on_options_to_cart_response.json index 7c89e2e89..2a1a0e234 100644 --- a/tests/Responses/Expected/cart/add_product_variant_based_on_options_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_product_variant_based_on_options_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 3, "total": 1500, "product": { diff --git a/tests/Responses/Expected/cart/add_product_variant_multiple_times_to_cart_response.json b/tests/Responses/Expected/cart/add_product_variant_multiple_times_to_cart_response.json index 3700e3889..b36027e04 100644 --- a/tests/Responses/Expected/cart/add_product_variant_multiple_times_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_product_variant_multiple_times_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 6, "total": 11994, "product": { diff --git a/tests/Responses/Expected/cart/add_product_variant_to_cart_response.json b/tests/Responses/Expected/cart/add_product_variant_to_cart_response.json index ceb14516e..42d1ce514 100644 --- a/tests/Responses/Expected/cart/add_product_variant_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_product_variant_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 3, "total": 5997, "product": { diff --git a/tests/Responses/Expected/cart/add_simple_product_multiple_times_to_cart_response.json b/tests/Responses/Expected/cart/add_simple_product_multiple_times_to_cart_response.json index 877ac5806..cb6a30517 100644 --- a/tests/Responses/Expected/cart/add_simple_product_multiple_times_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_simple_product_multiple_times_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 2, "total": 3998, "product": { diff --git a/tests/Responses/Expected/cart/add_simple_product_to_cart_response.json b/tests/Responses/Expected/cart/add_simple_product_to_cart_response.json index fa03a1fea..583ca4415 100644 --- a/tests/Responses/Expected/cart/add_simple_product_to_cart_response.json +++ b/tests/Responses/Expected/cart/add_simple_product_to_cart_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 3, "total": 5997, "product": { diff --git a/tests/Responses/Expected/cart/cart_with_coupon_based_promotion_applied_response.json b/tests/Responses/Expected/cart/cart_with_coupon_based_promotion_applied_response.json index bfbf3e861..24a96f294 100644 --- a/tests/Responses/Expected/cart/cart_with_coupon_based_promotion_applied_response.json +++ b/tests/Responses/Expected/cart/cart_with_coupon_based_promotion_applied_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 8995, "product": { diff --git a/tests/Responses/Expected/cart/filled_cart_with_product_variant_summary_response.json b/tests/Responses/Expected/cart/filled_cart_with_product_variant_summary_response.json index da79566ae..2b7b9103e 100644 --- a/tests/Responses/Expected/cart/filled_cart_with_product_variant_summary_response.json +++ b/tests/Responses/Expected/cart/filled_cart_with_product_variant_summary_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 3, "total": 5997, "product": { @@ -59,7 +59,7 @@ } }, { - "id": 2, + "id": @integer@, "quantity": 3, "total": 1500, "product": { diff --git a/tests/Responses/Expected/cart/filled_cart_with_simple_product_summary_response.json b/tests/Responses/Expected/cart/filled_cart_with_simple_product_summary_response.json index ca67be8b6..377f1ac65 100644 --- a/tests/Responses/Expected/cart/filled_cart_with_simple_product_summary_response.json +++ b/tests/Responses/Expected/cart/filled_cart_with_simple_product_summary_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 9995, "product": { diff --git a/tests/Responses/Expected/cart/german_filled_cart_with_product_variant_summary_response.json b/tests/Responses/Expected/cart/german_filled_cart_with_product_variant_summary_response.json index 6854f2c54..d1e1a2486 100644 --- a/tests/Responses/Expected/cart/german_filled_cart_with_product_variant_summary_response.json +++ b/tests/Responses/Expected/cart/german_filled_cart_with_product_variant_summary_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 3, "total": 1770, "product": { diff --git a/tests/Responses/Expected/cart/german_filled_cart_with_simple_product_summary_response.json b/tests/Responses/Expected/cart/german_filled_cart_with_simple_product_summary_response.json index ebb19a09e..1efecee23 100644 --- a/tests/Responses/Expected/cart/german_filled_cart_with_simple_product_summary_response.json +++ b/tests/Responses/Expected/cart/german_filled_cart_with_simple_product_summary_response.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 10495, "product": { diff --git a/tests/Responses/Expected/cart/reprocessed_cart_after_deleting_an_item.json b/tests/Responses/Expected/cart/reprocessed_cart_after_deleting_an_item.json index a66d4095f..f9fe58c09 100644 --- a/tests/Responses/Expected/cart/reprocessed_cart_after_deleting_an_item.json +++ b/tests/Responses/Expected/cart/reprocessed_cart_after_deleting_an_item.json @@ -6,7 +6,7 @@ "checkoutState": "cart", "items": [ { - "id": 1, + "id": @integer@, "quantity": 1, "total": 1999, "product": { diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index f09e01d8b..e3451cefa 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -6,7 +6,7 @@ "checkoutState": "addressed", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 9995, "product": { diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index b9e5853f6..11d7af1b6 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -6,7 +6,7 @@ "checkoutState": "addressed", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 9995, "product": { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json index 86eb87c49..3cc6a997c 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json @@ -6,7 +6,7 @@ "checkoutState": "payment_selected", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 9995, "product": { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json index b9d1bdf60..a8dbc728f 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json @@ -6,7 +6,7 @@ "checkoutState": "shipping_selected", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 9995, "product": { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json index 9ca294dc6..b6f5918bd 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json @@ -6,7 +6,7 @@ "checkoutState": "shipping_selected", "items": [ { - "id": 1, + "id": @integer@, "quantity": 5, "total": 9995, "product": { diff --git a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json index 0e1f26d1e..36c407f47 100644 --- a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json @@ -6,7 +6,7 @@ "checkoutState": "shipping_selected", "items": [ { - "id": 1, + "id": @integer@, "quantity": 2, "total": 3998, "product": { diff --git a/tests/Responses/Expected/customer/update_customer.json b/tests/Responses/Expected/customer/update_customer.json index 5feca8651..b2b928e1e 100644 --- a/tests/Responses/Expected/customer/update_customer.json +++ b/tests/Responses/Expected/customer/update_customer.json @@ -1,10 +1,10 @@ { - "id": 1, - "firstName": "New name", - "lastName": "New lastName", - "email": "oliver@queen.com", - "birthday": "@string@", - "gender": "m", - "phoneNumber": "0918972132", - "subscribedToNewsletter": true + "id": @integer@, + "firstName": "New name", + "lastName": "New lastName", + "email": "oliver@queen.com", + "birthday": "@string@", + "gender": "m", + "phoneNumber": "0918972132", + "subscribedToNewsletter": true } diff --git a/tests/Responses/Expected/product/product_review_list_page_by_code_response.json b/tests/Responses/Expected/product/product_review_list_page_by_code_response.json index aa02e58b4..8ecf32cf5 100644 --- a/tests/Responses/Expected/product/product_review_list_page_by_code_response.json +++ b/tests/Responses/Expected/product/product_review_list_page_by_code_response.json @@ -2,7 +2,7 @@ "page": 1, "limit": 10, "pages": 3, - "total": 23, + "total": 25, "_links": { "self": "\/shop-api\/products\/LOGAN_MUG_CODE\/reviews?channel=WEB_GB&page=1&limit=10", "first": "\/shop-api\/products\/LOGAN_MUG_CODE\/reviews?channel=WEB_GB&page=1&limit=10", diff --git a/tests/Responses/Expected/product/product_review_list_page_by_slug_response.json b/tests/Responses/Expected/product/product_review_list_page_by_slug_response.json index d136fdf0a..ec12f84cb 100644 --- a/tests/Responses/Expected/product/product_review_list_page_by_slug_response.json +++ b/tests/Responses/Expected/product/product_review_list_page_by_slug_response.json @@ -2,7 +2,7 @@ "page": 1, "limit": 10, "pages": 3, - "total": 23, + "total": 25, "_links": { "self": "\/shop-api\/product-reviews-by-slug\/logan-mug?channel=WEB_GB&page=1&limit=10", "first": "\/shop-api\/product-reviews-by-slug\/logan-mug?channel=WEB_GB&page=1&limit=10",