From a9aba78199a3764c72d7a6f8a047b3e806c69b9f Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 13 Nov 2023 12:13:18 +0100 Subject: [PATCH] Refactor AkeneoContext --- .../{AkeneoContext.php => AkeneoProductContext.php} | 11 ++--------- tests/Behat/Resources/services.xml | 4 +--- tests/Behat/Resources/suites.yml | 10 +++++----- 3 files changed, 8 insertions(+), 17 deletions(-) rename tests/Behat/Context/Setup/{AkeneoContext.php => AkeneoProductContext.php} (88%) diff --git a/tests/Behat/Context/Setup/AkeneoContext.php b/tests/Behat/Context/Setup/AkeneoProductContext.php similarity index 88% rename from tests/Behat/Context/Setup/AkeneoContext.php rename to tests/Behat/Context/Setup/AkeneoProductContext.php index 3ba4f437..9df6396b 100644 --- a/tests/Behat/Context/Setup/AkeneoContext.php +++ b/tests/Behat/Context/Setup/AkeneoProductContext.php @@ -11,13 +11,8 @@ use Tests\Webgriffe\SyliusAkeneoPlugin\InMemory\Client\InMemoryAkeneoPimClient; use Webmozart\Assert\Assert; -final class AkeneoContext implements Context +final class AkeneoProductContext implements Context { - public function __construct( - private InMemoryAkeneoPimClient $apiClient, - ) { - } - /** * @BeforeScenario */ @@ -32,9 +27,7 @@ public function clear(): void */ public function thereIsAProductUpdatedAtOnAkeneo(string $identifier, DateTime $date = null): void { - $productsApi = $this->apiClient->getProductApi(); - Assert::isInstanceOf($productsApi, InMemoryProductApi::class); - $productsApi::addResource(Product::create($identifier, ['updated' => $date])); + InMemoryProductApi::addResource(Product::create($identifier, ['updated' => $date])); } /** diff --git a/tests/Behat/Resources/services.xml b/tests/Behat/Resources/services.xml index f62ecee4..dbf1f2ca 100644 --- a/tests/Behat/Resources/services.xml +++ b/tests/Behat/Resources/services.xml @@ -7,9 +7,7 @@ - - - + diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index 4df5b142..806af573 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -7,7 +7,7 @@ default: - sylius.behat.context.setup.product - sylius.behat.context.setup.channel - sylius.behat.context.setup.locale - - webgriffe_sylius_akeneo.behat.context.setup.akeneo + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product_model - webgriffe_sylius_akeneo.behat.context.setup.akeneo_family_variant - webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute @@ -30,7 +30,7 @@ default: - sylius.behat.context.setup.channel - sylius.behat.context.setup.admin_security - sylius.behat.context.setup.product - - webgriffe_sylius_akeneo.behat.context.setup.akeneo + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product - webgriffe_sylius_akeneo.behat.context.db.product @@ -47,7 +47,7 @@ default: - sylius.behat.context.setup.product - sylius.behat.context.setup.product_association - sylius.behat.context.setup.channel - - webgriffe_sylius_akeneo.behat.context.setup.akeneo + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product - webgriffe_sylius_akeneo.behat.context.db.product @@ -65,7 +65,7 @@ default: - sylius.behat.context.setup.admin_security - sylius.behat.context.setup.product_association - - webgriffe_sylius_akeneo.behat.context.setup.akeneo + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product - webgriffe_sylius_akeneo.behat.context.cli.import_command @@ -89,7 +89,7 @@ default: - sylius.behat.context.setup.channel - sylius.behat.context.setup.product - - webgriffe_sylius_akeneo.behat.context.setup.akeneo + - webgriffe_sylius_akeneo.behat.context.setup.akeneo_product - webgriffe_sylius_akeneo.behat.context.db.product