Skip to content

Commit

Permalink
Provide compatibility with Symfony 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Aug 21, 2018
1 parent bb77ad6 commit 121aab8
Show file tree
Hide file tree
Showing 42 changed files with 105 additions and 129 deletions.
5 changes: 2 additions & 3 deletions tests/Controller/AddressBookCreateAddressApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,12 +45,12 @@ public function it_allows_user_to_add_new_address_to_address_book()
$this->assertResponseCode($response, Response::HTTP_NO_CONTENT);

/** @var CustomerRepositoryInterface $customerRepository */
$customerRepository = self::$container->get('sylius.repository.customer');
$customerRepository = $this->get('sylius.repository.customer');
/** @var Customer $customer */
$customer = $customerRepository->findOneBy(['email' => 'oliver@queen.com']);

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var AddressInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Kupreska 12']);

Expand Down
5 changes: 2 additions & 3 deletions tests/Controller/AddressBookRemoveAddressApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +25,7 @@ public function it_deletes_address_from_address_book()
$this->logInUser('oliver@queen.com', '123password');

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var AddressInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Kupreska']);

Expand Down Expand Up @@ -62,7 +61,7 @@ public function it_validates_if_current_user_is_owner_of_address()
$this->logInUser('oliver@queen.com', '123password');

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var AddressInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Vukovarska']);

Expand Down
5 changes: 2 additions & 3 deletions tests/Controller/AddressBookSetDefaultAddressApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,7 +27,7 @@ public function it_sets_given_address_as_default()
$this->logInUser('oliver@queen.com', '123password');

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var ResourceInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Kupreska']);

Expand All @@ -37,7 +36,7 @@ public function it_sets_given_address_as_default()
$this->assertResponseCode($response, Response::HTTP_NO_CONTENT);

/** @var UserRepositoryInterface $userRepository */
$userRepository = self::$container->get('sylius.repository.shop_user');
$userRepository = $this->get('sylius.repository.shop_user');
/** @var ShopUser $address */
$shopUser = $userRepository->findOneBy(['username' => 'oliver@queen.com']);

Expand Down
1 change: 0 additions & 1 deletion tests/Controller/AddressBookShowApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 3 additions & 4 deletions tests/Controller/AddressBookUpdateAddressApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +25,7 @@ public function it_updates_address_in_address_book()
$this->logInUser('oliver@queen.com', '123password');

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var AddressInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Kupreska']);

Expand Down Expand Up @@ -69,7 +68,7 @@ public function it_does_not_allow_to_update_address_if_country_or_province_code_
$this->logInUser('oliver@queen.com', '123password');

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var AddressInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Kupreska']);

Expand Down Expand Up @@ -102,7 +101,7 @@ public function it_does_not_allow_to_update_address_without_passing_required_dat
$this->logInUser('oliver@queen.com', '123password');

/** @var AddressRepositoryInterface $addressRepository */
$addressRepository = self::$container->get('sylius.repository.address');
$addressRepository = $this->get('sylius.repository.address');
/** @var AddressInterface $address */
$address = $addressRepository->findOneBy(['street' => 'Kupreska']);

Expand Down
11 changes: 5 additions & 6 deletions tests/Controller/CartAddCouponShopApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,7 +23,7 @@ public function it_allows_to_add_promotion_coupon_to_the_cart()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));

Expand Down Expand Up @@ -52,7 +51,7 @@ public function it_does_not_allow_to_add_promotion_if_coupon_is_not_specified()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));

Expand Down Expand Up @@ -94,7 +93,7 @@ public function it_does_not_allow_to_add_promotion_code_if_promotion_code_does_n
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));

Expand Down Expand Up @@ -122,7 +121,7 @@ public function it_does_not_allow_to_add_promotion_code_if_code_is_invalid()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));

Expand Down Expand Up @@ -150,7 +149,7 @@ public function it_does_not_allow_to_add_promotion_code_if_related_promotion_is_
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));

Expand Down
1 change: 0 additions & 1 deletion tests/Controller/CartApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Tests\Sylius\ShopApiPlugin\Controller;

use Lakion\ApiTestCase\JsonApiTestCase;
use Symfony\Component\HttpFoundation\Response;

final class CartApiTest extends JsonApiTestCase
Expand Down
11 changes: 5 additions & 6 deletions tests/Controller/CartChangeItemQuantityApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

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;
Expand Down Expand Up @@ -45,7 +44,7 @@ public function it_changes_item_quantity()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 3));

Expand All @@ -71,7 +70,7 @@ public function it_does_not_allow_to_set_quantity_lower_than_one()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 3));

Expand All @@ -97,7 +96,7 @@ public function it_does_not_allow_to_change_quantity_without_quantity_defined()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 3));

Expand All @@ -117,7 +116,7 @@ public function it_does_not_allow_to_change_quantity_if_cart_item_does_not_exist
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));

$data =
Expand All @@ -135,7 +134,7 @@ public function it_does_not_allow_to_change_quantity_if_cart_item_does_not_exist
private function getFirstOrderItemId(string $orderToken): string
{
/** @var OrderRepositoryInterface $orderRepository */
$orderRepository = self::$container->get('sylius.repository.order');
$orderRepository = $this->get('sylius.repository.order');

$order = $orderRepository->findOneBy(['tokenValue' => $orderToken]);

Expand Down
7 changes: 3 additions & 4 deletions tests/Controller/CartDropCartApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,7 +45,7 @@ public function it_deletes_a_cart()
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));

Expand All @@ -66,7 +65,7 @@ public function it_returns_not_found_exception_if_order_is_in_different_state_th
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));
$bus->handle(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5));
$bus->handle(new AddressOrder(
Expand All @@ -93,7 +92,7 @@ public function it_returns_not_found_exception_if_order_is_in_different_state_th
$bus->handle(new ChoosePaymentMethod($token, 0, 'PBC'));

/** @var OrderInterface $order */
$order = self::$container->get('sylius.repository.order')->findOneBy(['tokenValue' => $token]);
$order = $this->get('sylius.repository.order')->findOneBy(['tokenValue' => $token]);

$bus->handle(new CompleteOrder($token, 'sylius@example.com'));

Expand Down
3 changes: 1 addition & 2 deletions tests/Controller/CartPickupApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,7 +43,7 @@ public function it_does_not_allow_to_create_a_new_cart_if_token_is_already_used(
$token = 'SDAOSLEFNWU35H3QLI5325';

/** @var CommandBus $bus */
$bus = self::$container->get('tactician.commandbus');
$bus = $this->get('tactician.commandbus');
$bus->handle(new PickupCart($token, 'WEB_GB'));

$data =
Expand Down
Loading

0 comments on commit 121aab8

Please sign in to comment.