Skip to content

Commit

Permalink
Refactor AkeneoContext
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Nov 13, 2023
1 parent 03f24c4 commit a9aba78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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]));
}

/**
Expand Down
4 changes: 1 addition & 3 deletions tests/Behat/Resources/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
<services>
<defaults public="true" />

<service id="webgriffe_sylius_akeneo.behat.context.setup.akeneo" class="Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Setup\AkeneoContext">
<argument type="service" id="webgriffe_sylius_akeneo.api_client" />
</service>
<service id="webgriffe_sylius_akeneo.behat.context.setup.akeneo_product" class="Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Setup\AkeneoProductContext"/>

<service id="webgriffe_sylius_akeneo.behat.context.setup.akeneo_product_model" class="Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Setup\AkeneoProductModelContext"/>

Expand Down
10 changes: 5 additions & 5 deletions tests/Behat/Resources/suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit a9aba78

Please sign in to comment.