diff --git a/composer.json b/composer.json index f56f51daf..59c8d7e8b 100644 --- a/composer.json +++ b/composer.json @@ -7,17 +7,16 @@ "php": "^7.1", "sylius/sylius": "^1.1", - "league/tactician-bundle": "^0.4", + "league/tactician-bundle": "^1.1", "league/tactician-doctrine": "^1.1" }, "require-dev": { - "lakion/api-test-case": "^1.1", - "phpspec/phpspec": "^3.2", - "lexik/jwt-authentication-bundle": "^2.4", - "matthiasnoback/symfony-config-test": "^2.0", - "matthiasnoback/symfony-dependency-injection-test": "^1.0", - "phpunit/phpunit": "^5.6", - "doctrine/common": "<2.8", + "lakion/api-test-case": "^3.1", + "phpspec/phpspec": "^5.0", + "lexik/jwt-authentication-bundle": "^2.5", + "matthiasnoback/symfony-config-test": "^3.1", + "matthiasnoback/symfony-dependency-injection-test": "^2.3", + "phpunit/phpunit": "^6.5", "sylius-labs/coding-standard": "^2.0" }, "autoload": { @@ -28,7 +27,8 @@ "autoload-dev": { "psr-4": { "Tests\\Sylius\\ShopApiPlugin\\": "tests/" - } + }, + "classmap": ["tests/Application/app/AppKernel.php"] }, "suggest": { "nelmio/cors-bundle": "allows you to send Cross-Origin Ajax API Request" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5cfc318fb..15ed38eef 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,9 +1,7 @@ - @@ -14,8 +12,9 @@ - + + diff --git a/spec/Handler/SetDefaultAddressHandlerSpec.php b/spec/Handler/SetDefaultAddressHandlerSpec.php index b891de3f6..31043d064 100644 --- a/spec/Handler/SetDefaultAddressHandlerSpec.php +++ b/spec/Handler/SetDefaultAddressHandlerSpec.php @@ -7,6 +7,7 @@ use PhpSpec\ObjectBehavior; use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\Customer; +use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\ShopUserInterface; use Sylius\Component\Core\Repository\AddressRepositoryInterface; use Sylius\Component\Core\Repository\CustomerRepositoryInterface; @@ -40,36 +41,36 @@ function it_handles_setting_default_address_for_user( $user->getCustomer()->willReturn($customer); $address->getCustomer()->willReturn($customer); - $customer->getId()->willReturn('USER_ID'); - $user->getId()->willReturn('USER_ID'); + $customer->getId()->willReturn('CUSTOMER_ID'); $customer->setDefaultAddress($address)->shouldBeCalled(); $this->handle(new SetDefaultAddress(1, 'user@email.com')); } - function it_trows_exception_if_address_does_not_belong_to_current_user( + function it_throws_exception_if_address_does_not_belong_to_current_user( AddressInterface $address, AddressRepositoryInterface $addressRepository, RepositoryInterface $shopUserRepository, ShopUserInterface $user, - Customer $customer + CustomerInterface $customer, + CustomerInterface $anotherCustomer ) { $shopUserRepository->findOneBy(['username' => 'user@email.com'])->willReturn($user); $addressRepository->find(1)->willReturn($address); $user->getCustomer()->willReturn($customer); - $address->getCustomer()->willReturn($customer); + $address->getCustomer()->willReturn($anotherCustomer); - $customer->getId()->willReturn('USER_ID_1'); - $user->getId()->willReturn('USER_ID_2'); + $customer->getId()->willReturn('CUSTOMER_ID'); + $anotherCustomer->getId()->willReturn('ANOTHER_CUSTOMER_ID'); $this->shouldThrow(\InvalidArgumentException::class)->during('handle', [ new SetDefaultAddress(1, 'user@email.com'), ]); } - function it_trows_exception_if_address_is_not_associated_with_any_user( + function it_throws_exception_if_address_is_not_associated_with_any_user( AddressInterface $address, AddressRepositoryInterface $addressRepository, RepositoryInterface $shopUserRepository, @@ -80,7 +81,7 @@ function it_trows_exception_if_address_is_not_associated_with_any_user( $address->getCustomer()->willReturn(null); - $user->getId()->shouldNotBeCalled(); + $user->getCustomer()->shouldNotBeCalled(); $this->shouldThrow(\InvalidArgumentException::class)->during('handle', [ new SetDefaultAddress(1, 'user@email.com'), 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 f90a4f700..2386179fc 100644 --- a/tests/Application/app/AppKernel.php +++ b/tests/Application/app/AppKernel.php @@ -22,6 +22,9 @@ public function registerBundles(): array new \Sylius\ShopApiPlugin\ShopApiPlugin(), new \Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle(), + + new \Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle(), + new \Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle(), ]); } diff --git a/tests/Application/app/config/security.yml b/tests/Application/app/config/security.yml index 091d1a09b..10f94547a 100644 --- a/tests/Application/app/config/security.yml +++ b/tests/Application/app/config/security.yml @@ -21,6 +21,7 @@ security: switch_user: true context: admin pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider form_login: provider: sylius_admin_user_provider login_path: sylius_admin_login @@ -49,9 +50,10 @@ security: api: pattern: "%sylius.security.api_regex%" - fos_oauth: true - stateless: true - anonymous: true + provider: sylius_admin_user_provider + fos_oauth: true + stateless: true + anonymous: true shop_api_login: pattern: "%shop_api.security.regex%/login" @@ -67,9 +69,10 @@ security: shop_api: pattern: "%shop_api.security.regex%" - stateless: true - anonymous: true + stateless: true + anonymous: true guard: + provider: sylius_shop_user_provider authenticators: - lexik_jwt_authentication.jwt_token_authenticator @@ -77,6 +80,7 @@ security: switch_user: { role: ROLE_ALLOWED_TO_SWITCH } context: shop pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider form_login: success_handler: sylius.authentication.success_handler failure_handler: sylius.authentication.failure_handler diff --git a/tests/Controller/AddressBookCreateAddressApiTest.php b/tests/Controller/AddressBookCreateAddressApiTest.php index 31164be58..4180f3abc 100644 --- a/tests/Controller/AddressBookCreateAddressApiTest.php +++ b/tests/Controller/AddressBookCreateAddressApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use PHPUnit\Framework\Assert; use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\Customer; @@ -24,9 +23,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 = <<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'); @@ -46,10 +43,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,10 +57,8 @@ 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'); diff --git a/tests/Controller/AddressBookSetDefaultAddressApiTest.php b/tests/Controller/AddressBookSetDefaultAddressApiTest.php index f7abe0738..9e53e9cc7 100644 --- a/tests/Controller/AddressBookSetDefaultAddressApiTest.php +++ b/tests/Controller/AddressBookSetDefaultAddressApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use PHPUnit\Framework\Assert; use Sylius\Component\Core\Model\ShopUser; use Sylius\Component\Core\Repository\AddressRepositoryInterface; @@ -24,10 +23,8 @@ 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'); diff --git a/tests/Controller/AddressBookShowApiTest.php b/tests/Controller/AddressBookShowApiTest.php index 4bc262ef8..46cb03f6c 100644 --- a/tests/Controller/AddressBookShowApiTest.php +++ b/tests/Controller/AddressBookShowApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; use Tests\Sylius\ShopApiPlugin\Controller\Utils\ShopUserLoginTrait; @@ -17,10 +16,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..652ce321f 100644 --- a/tests/Controller/AddressBookUpdateAddressApiTest.php +++ b/tests/Controller/AddressBookUpdateAddressApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use PHPUnit\Framework\Assert; use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Repository\AddressRepositoryInterface; @@ -22,10 +21,8 @@ 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'); @@ -67,10 +64,8 @@ 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'); @@ -102,10 +97,8 @@ 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'); diff --git a/tests/Controller/CartAddCouponShopApiTest.php b/tests/Controller/CartAddCouponShopApiTest.php index 88270927c..4d64cbaf9 100644 --- a/tests/Controller/CartAddCouponShopApiTest.php +++ b/tests/Controller/CartAddCouponShopApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\PickupCart; use Sylius\ShopApiPlugin\Command\PutSimpleItemToCart; @@ -19,8 +18,7 @@ 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'; @@ -48,7 +46,7 @@ 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'; @@ -69,7 +67,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'; @@ -118,8 +116,7 @@ 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'; @@ -147,8 +144,7 @@ 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'; diff --git a/tests/Controller/CartApiTest.php b/tests/Controller/CartApiTest.php index 1db574e87..c0f2d5ba1 100644 --- a/tests/Controller/CartApiTest.php +++ b/tests/Controller/CartApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class CartApiTest extends JsonApiTestCase @@ -16,7 +15,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 +28,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 +46,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..3cd84853d 100644 --- a/tests/Controller/CartChangeItemQuantityApiTest.php +++ b/tests/Controller/CartChangeItemQuantityApiTest.php @@ -4,8 +4,9 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -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 +20,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'; @@ -53,7 +54,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,7 +65,7 @@ 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'; @@ -79,7 +80,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,7 +91,7 @@ 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'; @@ -99,7 +100,7 @@ public function it_does_not_allow_to_change_quantity_without_quantity_defined() $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,7 +111,7 @@ 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'; @@ -124,9 +125,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 = $this->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..4fa0bed78 100644 --- a/tests/Controller/CartDropCartApiTest.php +++ b/tests/Controller/CartDropCartApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\Component\Core\Model\OrderInterface; use Sylius\ShopApiPlugin\Command\AddressOrder; @@ -23,7 +22,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,7 +40,7 @@ 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'; @@ -61,10 +60,7 @@ 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'; diff --git a/tests/Controller/CartPickupApiTest.php b/tests/Controller/CartPickupApiTest.php index f85ca3a18..a7d895376 100644 --- a/tests/Controller/CartPickupApiTest.php +++ b/tests/Controller/CartPickupApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\PickupCart; use Symfony\Component\HttpFoundation\Response; @@ -18,7 +17,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'; @@ -66,7 +65,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..22a728480 100644 --- a/tests/Controller/CartPutItemToCartApiTest.php +++ b/tests/Controller/CartPutItemToCartApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\Component\Core\Model\OrderInterface; use Sylius\ShopApiPlugin\Command\AddressOrder; @@ -25,7 +24,7 @@ final class CartPutItemToCartApiTest extends JsonApiTestCase */ public function it_adds_a_product_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -51,7 +50,7 @@ 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'; @@ -78,7 +77,7 @@ 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'; @@ -104,7 +103,7 @@ 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'; @@ -130,7 +129,7 @@ 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'; @@ -156,7 +155,7 @@ 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'; @@ -181,7 +180,7 @@ 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'; @@ -207,7 +206,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,10 +228,7 @@ 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'; @@ -286,7 +282,7 @@ 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'; @@ -313,7 +309,7 @@ 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'; @@ -341,7 +337,7 @@ 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'; @@ -368,7 +364,7 @@ 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'; @@ -395,7 +391,7 @@ 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'; @@ -421,7 +417,7 @@ 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'; @@ -448,7 +444,7 @@ 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'; @@ -475,7 +471,7 @@ 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'; @@ -499,7 +495,7 @@ 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'; @@ -528,7 +524,7 @@ 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'; @@ -558,7 +554,7 @@ 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'; diff --git a/tests/Controller/CartPutItemsToCartApiTest.php b/tests/Controller/CartPutItemsToCartApiTest.php index bbb3467a1..8a1ffca16 100644 --- a/tests/Controller/CartPutItemsToCartApiTest.php +++ b/tests/Controller/CartPutItemsToCartApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\PickupCart; use Symfony\Component\HttpFoundation\Response; @@ -18,7 +17,7 @@ final class CartPutItemsToCartApiTest extends JsonApiTestCase */ public function it_adds_a_product_to_the_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -59,7 +58,7 @@ 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'; @@ -100,7 +99,7 @@ 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'; diff --git a/tests/Controller/CartRemoveCouponShopApiTest.php b/tests/Controller/CartRemoveCouponShopApiTest.php index 19aa4f063..7031881b2 100644 --- a/tests/Controller/CartRemoveCouponShopApiTest.php +++ b/tests/Controller/CartRemoveCouponShopApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\AddCoupon; use Sylius\ShopApiPlugin\Command\PickupCart; @@ -20,8 +19,7 @@ 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'; @@ -43,8 +41,7 @@ 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'; @@ -65,7 +62,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..c6f200e2f 100644 --- a/tests/Controller/CartRemoveItemFromCartApiTest.php +++ b/tests/Controller/CartRemoveItemFromCartApiTest.php @@ -4,8 +4,9 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -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,7 +19,7 @@ final class CartRemoveItemFromCartApiTest extends JsonApiTestCase */ public function it_deletes_item() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -27,7 +28,15 @@ public function it_deletes_item() $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 = $this->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,7 +47,7 @@ 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'; @@ -46,7 +55,7 @@ public function it_returns_not_found_exception_if_cart_item_has_not_been_found() $bus = $this->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,8 +66,7 @@ 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'; @@ -68,7 +76,15 @@ public function it_reprocesses_the_order_after_deleting_an_item() $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 = $this->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..e8f24b617 100644 --- a/tests/Controller/CartSummarizeApiTest.php +++ b/tests/Controller/CartSummarizeApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\AddCoupon; use Sylius\ShopApiPlugin\Command\PickupCart; @@ -20,7 +19,7 @@ final class CartSummarizeApiTest extends JsonApiTestCase */ public function it_shows_summary_of_an_empty_cart() { - $this->loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -39,7 +38,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,7 +51,7 @@ 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'; @@ -72,7 +71,7 @@ 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'; @@ -92,7 +91,7 @@ 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'; @@ -134,7 +133,7 @@ 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'; @@ -167,8 +166,7 @@ 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'; diff --git a/tests/Controller/CheckoutAddressApiTest.php b/tests/Controller/CheckoutAddressApiTest.php index 8bc2362ea..b921f1fa5 100644 --- a/tests/Controller/CheckoutAddressApiTest.php +++ b/tests/Controller/CheckoutAddressApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\PickupCart; use Sylius\ShopApiPlugin\Command\PutSimpleItemToCart; @@ -27,7 +26,7 @@ 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'; @@ -62,7 +61,7 @@ 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'; @@ -96,7 +95,7 @@ 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'; diff --git a/tests/Controller/CheckoutChoosePaymentMethodApiTest.php b/tests/Controller/CheckoutChoosePaymentMethodApiTest.php index 7ca6fd0f9..19052ccc6 100644 --- a/tests/Controller/CheckoutChoosePaymentMethodApiTest.php +++ b/tests/Controller/CheckoutChoosePaymentMethodApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\AddressOrder; use Sylius\ShopApiPlugin\Command\ChooseShippingMethod; @@ -20,10 +19,7 @@ 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'; diff --git a/tests/Controller/CheckoutChooseShippingMethodApiTest.php b/tests/Controller/CheckoutChooseShippingMethodApiTest.php index 01a0d3973..2b7f9fc00 100644 --- a/tests/Controller/CheckoutChooseShippingMethodApiTest.php +++ b/tests/Controller/CheckoutChooseShippingMethodApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\AddressOrder; use Sylius\ShopApiPlugin\Command\PickupCart; @@ -19,9 +18,7 @@ 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'; diff --git a/tests/Controller/CheckoutCompleteOrderApiTest.php b/tests/Controller/CheckoutCompleteOrderApiTest.php index 69e1a08e1..f29a51b74 100644 --- a/tests/Controller/CheckoutCompleteOrderApiTest.php +++ b/tests/Controller/CheckoutCompleteOrderApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\AddressOrder; use Sylius\ShopApiPlugin\Command\ChoosePaymentMethod; @@ -21,10 +20,7 @@ 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'; @@ -75,10 +71,7 @@ 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'; @@ -130,11 +123,7 @@ 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'; @@ -169,7 +158,7 @@ public function it_allows_to_complete_checkout_without_email_for_logged_in_custo <<loadFixturesFromFile('shop.yml'); + $this->loadFixturesFromFiles(['shop.yml']); $token = 'SDAOSLEFNWU35H3QLI5325'; @@ -42,7 +41,7 @@ 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'; @@ -83,10 +82,7 @@ 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'; diff --git a/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php b/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php index 171136e22..990285c1a 100644 --- a/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php +++ b/tests/Controller/CheckoutShowAvailableShippingMethodsShopApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use League\Tactician\CommandBus; use Sylius\ShopApiPlugin\Command\AddressOrder; use Sylius\ShopApiPlugin\Command\PickupCart; @@ -27,9 +26,7 @@ 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'; @@ -66,7 +63,7 @@ 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'; diff --git a/tests/Controller/CheckoutSummarizeApiTest.php b/tests/Controller/CheckoutSummarizeApiTest.php index 1b26532e5..9bb0223de 100644 --- a/tests/Controller/CheckoutSummarizeApiTest.php +++ b/tests/Controller/CheckoutSummarizeApiTest.php @@ -4,8 +4,9 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -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,7 +23,7 @@ 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'; @@ -59,7 +60,7 @@ 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'; @@ -105,9 +106,7 @@ 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'; @@ -157,9 +156,7 @@ 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'; @@ -203,13 +200,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 = $this->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,10 +225,7 @@ 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'; diff --git a/tests/Controller/CustomerLoginApiTest.php b/tests/Controller/CustomerLoginApiTest.php index 9908c9b18..ff1687f4f 100644 --- a/tests/Controller/CustomerLoginApiTest.php +++ b/tests/Controller/CustomerLoginApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; use Tests\Sylius\ShopApiPlugin\Controller\Utils\PurgeSpooledMessagesTrait; @@ -21,13 +20,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 = <<loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<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"}'; diff --git a/tests/Controller/CustomerResendVerificationTokenApiTest.php b/tests/Controller/CustomerResendVerificationTokenApiTest.php index cb446bb11..6aee8ab3b 100644 --- a/tests/Controller/CustomerResendVerificationTokenApiTest.php +++ b/tests/Controller/CustomerResendVerificationTokenApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Sylius\Component\Core\Test\Services\EmailCheckerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; @@ -19,7 +18,7 @@ final class CustomerResendVerificationTokenApiTest extends JsonApiTestCase */ public function it_allows_to_resend_verification_token() { - $this->loadFixturesFromFile('channel.yml'); + $this->loadFixturesFromFiles(['channel.yml']); $data = <<loadFixturesFromFile('customer.yml'); + $this->loadFixturesFromFiles(['customer.yml']); $data = '{"email": "oliver@queen.com"}'; diff --git a/tests/Controller/CustomerUpdateCustomerApiTest.php b/tests/Controller/CustomerUpdateCustomerApiTest.php index 287b86b65..b506f94fa 100644 --- a/tests/Controller/CustomerUpdateCustomerApiTest.php +++ b/tests/Controller/CustomerUpdateCustomerApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use PHPUnit\Framework\Assert; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Repository\CustomerRepositoryInterface; @@ -22,8 +21,8 @@ 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'); @@ -61,7 +60,7 @@ public function it_updates_customer() */ public function it_does_not_allow_to_update_customer_without_being_logged_in() { - $this->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 = <<get($id); + } + + return parent::get($id); + } +} diff --git a/tests/Controller/LoggedInCustomerDetailsActionTest.php b/tests/Controller/LoggedInCustomerDetailsActionTest.php index ff006439b..8272c7052 100644 --- a/tests/Controller/LoggedInCustomerDetailsActionTest.php +++ b/tests/Controller/LoggedInCustomerDetailsActionTest.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace Tests\Sylius\ShopApiPlugin\Controller\Customer; +namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class LoggedInCustomerDetailsActionTest extends JsonApiTestCase @@ -14,13 +13,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 +26,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 +39,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 +52,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..dfab943f1 100644 --- a/tests/Controller/ProductShowCatalogBySlugApiTest.php +++ b/tests/Controller/ProductShowCatalogBySlugApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class ProductShowCatalogBySlugApiTest extends JsonApiTestCase @@ -14,7 +13,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 +26,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 +39,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 +52,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..247d77677 100644 --- a/tests/Controller/ProductShowDetailsByCodeApiTest.php +++ b/tests/Controller/ProductShowDetailsByCodeApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class ProductShowDetailsByCodeApiTest extends JsonApiTestCase @@ -14,7 +13,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 +37,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 +50,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 +63,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 +76,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 +89,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..db086ae35 100644 --- a/tests/Controller/ProductShowDetailsBySlugApiTest.php +++ b/tests/Controller/ProductShowDetailsBySlugApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class ProductShowDetailsBySlugApiTest extends JsonApiTestCase @@ -14,7 +13,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 +26,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 +50,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 +63,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 +76,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 +89,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 +102,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..767098f56 100644 --- a/tests/Controller/ProductShowLatestApiTest.php +++ b/tests/Controller/ProductShowLatestApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class ProductShowLatestApiTest extends JsonApiTestCase @@ -14,7 +13,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 +27,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..bca80712e 100644 --- a/tests/Controller/ProductShowReviewsByCodeApiTest.php +++ b/tests/Controller/ProductShowReviewsByCodeApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class ProductShowReviewsByCodeApiTest extends JsonApiTestCase @@ -14,9 +13,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..51ad1b3a2 100644 --- a/tests/Controller/ProductShowReviewsBySlugApiTest.php +++ b/tests/Controller/ProductShowReviewsBySlugApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class ProductShowReviewsBySlugApiTest extends JsonApiTestCase @@ -14,9 +13,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..d448ce94b 100644 --- a/tests/Controller/TaxonShowDetailsApiTest.php +++ b/tests/Controller/TaxonShowDetailsApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class TaxonShowDetailsApiTest extends JsonApiTestCase @@ -14,7 +13,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 +26,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 +39,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..120846873 100644 --- a/tests/Controller/TaxonShowTreeApiTest.php +++ b/tests/Controller/TaxonShowTreeApiTest.php @@ -4,7 +4,6 @@ namespace Tests\Sylius\ShopApiPlugin\Controller; -use Lakion\ApiTestCase\JsonApiTestCase; use Symfony\Component\HttpFoundation\Response; final class TaxonShowTreeApiTest extends JsonApiTestCase @@ -14,7 +13,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 +27,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",