Skip to content

Commit d082e5d

Browse files
committed
Fix tests
1 parent 0b71b98 commit d082e5d

File tree

6 files changed

+47
-3
lines changed

6 files changed

+47
-3
lines changed

features/importing_product_models.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Feature: Importing product models
1010
@cli
1111
Scenario: Importing product model and its variants
1212
Given there is an attribute "size" on Akeneo of type "pim_catalog_simpleselect"
13+
Given there is an option "M" for attribute "size" on Akeneo
14+
Given there is an option "L" for attribute "size" on Akeneo
1315

1416
And there is a family variant "accessories_size" on Akeneo for the family "accessories"
1517
And the family variant "accessories_size" of family "accessories" has the attribute "size" as axes of first level
@@ -18,10 +20,12 @@ Feature: Importing product models
1820

1921
And there is a product "BRAIDED_HAT_M" on Akeneo
2022
And the product "BRAIDED_HAT_M" has parent "MODEL_BRAIDED_HAT"
23+
And the product "BRAIDED_HAT_M" has an attribute "size" with data "M"
2124
And the product "BRAIDED_HAT_M" has a price attribute with amount "33.99" and currency "USD"
2225

2326
And there is a product "BRAIDED_HAT_L" on Akeneo
2427
And the product "BRAIDED_HAT_L" has parent "MODEL_BRAIDED_HAT"
28+
And the product "BRAIDED_HAT_L" has an attribute "size" with data "L"
2529
And the product "BRAIDED_HAT_L" has a price attribute with amount "33.00" and currency "USD"
2630

2731
And the store is also available in "it_IT"

features/importing_products.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Feature: Importing products
1010
@cli
1111
Scenario: Importing single product model and its variants
1212
Given there is an attribute "size" on Akeneo of type "pim_catalog_simpleselect"
13+
Given there is an option "M" for attribute "size" on Akeneo
14+
Given there is an option "L" for attribute "size" on Akeneo
1315

1416
And there is a family variant "accessories_size" on Akeneo for the family "accessories"
1517
And the family variant "accessories_size" of family "accessories" has the attribute "size" as axes of first level
@@ -18,10 +20,12 @@ Feature: Importing products
1820

1921
And there is a product "BRAIDED_HAT_M" on Akeneo
2022
And the product "BRAIDED_HAT_M" has parent "MODEL_BRAIDED_HAT"
23+
And the product "BRAIDED_HAT_M" has an attribute "size" with data "M"
2124
And the product "BRAIDED_HAT_M" has a price attribute with amount "33.99" and currency "USD"
2225

2326
And there is a product "BRAIDED_HAT_L" on Akeneo
2427
And the product "BRAIDED_HAT_L" has parent "MODEL_BRAIDED_HAT"
28+
And the product "BRAIDED_HAT_L" has an attribute "size" with data "L"
2529
And the product "BRAIDED_HAT_L" has a price attribute with amount "33.00" and currency "USD"
2630

2731
And the store is also available in "it_IT"
@@ -34,6 +38,8 @@ Feature: Importing products
3438
@cli
3539
Scenario: Importing products with images should not leave temporary files in temporary files directory
3640
Given there is an attribute "size" on Akeneo of type "pim_catalog_simpleselect"
41+
Given there is an option "M" for attribute "size" on Akeneo
42+
Given there is an option "L" for attribute "size" on Akeneo
3743
Given there is an attribute "attachment" on Akeneo of type "pim_catalog_file"
3844

3945
And there is a family variant "accessories_size" on Akeneo for the family "accessories"
@@ -43,12 +49,14 @@ Feature: Importing products
4349

4450
And there is a product "BRAIDED_HAT_M" on Akeneo
4551
And the product "BRAIDED_HAT_M" has parent "MODEL_BRAIDED_HAT"
52+
And the product "BRAIDED_HAT_M" has an attribute "size" with data "M"
4653
And the product "BRAIDED_HAT_M" has a price attribute with amount "33.99" and currency "USD"
4754
And the product "BRAIDED_HAT_M" has an attribute "attachment" with data "sample.pdf"
4855
And the product "BRAIDED_HAT_M" has an attribute "image" with data "star_wars_m.jpeg"
4956

5057
And there is a product "BRAIDED_HAT_L" on Akeneo
5158
And the product "BRAIDED_HAT_L" has parent "MODEL_BRAIDED_HAT"
59+
And the product "BRAIDED_HAT_L" has an attribute "size" with data "L"
5260
And the product "BRAIDED_HAT_L" has a price attribute with amount "33.00" and currency "USD"
5361
And the product "BRAIDED_HAT_L" has an attribute "attachment" with data "sample.pdf"
5462
And the product "BRAIDED_HAT_L" has an attribute "image" with data "star_wars_l.jpeg"

features/reconciliate_products.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Feature: Reconcile products
2222
And there is a product "PRODUCT_1_VARIANT_2" updated at "2021-04-19" on Akeneo
2323
And there is a product "PRODUCT_2_VARIANT_2" updated at "2021-04-19" on Akeneo
2424
And the store has a product "product-1-variant-1"
25-
And this product has "product-1-variant-2" variant priced at "$25"
25+
And this product has "product-1-variant-2" variant priced at "$25.00"
2626
And the store has a product "product-2-variant-1"
27-
And this product has "product-2-variant-2" variant priced at "$25"
27+
And this product has "product-2-variant-2" variant priced at "$25.00"
2828
And the store has a product "product-3-variant-1"
29-
And this product has "product-3-variant-2" variant priced at "$25"
29+
And this product has "product-3-variant-2" variant priced at "$25.00"
3030
When I reconcile items
3131
Then the "product-1-variant-1" product should be enabled
3232
And the "product-1-variant-1" product variant should be enabled
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Setup;
6+
7+
use Behat\Behat\Context\Context;
8+
use Tests\Webgriffe\SyliusAkeneoPlugin\InMemory\Client\Api\InMemoryAttributeOptionApi;
9+
use Tests\Webgriffe\SyliusAkeneoPlugin\InMemory\Client\Api\Model\AttributeOption;
10+
11+
final class AkeneoAttributeOptionContext implements Context
12+
{
13+
/**
14+
* @BeforeScenario
15+
*/
16+
public function clear(): void
17+
{
18+
InMemoryAttributeOptionApi::$attributeOptions = [];
19+
}
20+
21+
/**
22+
* @Given there is an option :code for attribute :attributeCode on Akeneo
23+
*/
24+
public function thereIsAnOptionForAttributeOnAkeneo(string $code, string $attributeCode): void
25+
{
26+
InMemoryAttributeOptionApi::addResource(new AttributeOption($code, $attributeCode, 1, []));
27+
}
28+
}

tests/Behat/Resources/services.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
<service id="webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute" class="Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Setup\AkeneoAttributeContext"/>
1717

18+
<service id="webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute_option" class="Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Setup\AkeneoAttributeOptionContext"/>
19+
1820
<service id="webgriffe_sylius_akeneo.behat.context.cli.import_command" class="Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Cli\ImportCommandContext">
1921
<argument type="service" id="kernel" />
2022
<argument type="service" id="webgriffe_sylius_akeneo.command.import" />

tests/Behat/Resources/suites.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ default:
1111
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_product_model
1212
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_family_variant
1313
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute
14+
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute_option
1415

1516
- webgriffe_sylius_akeneo.behat.context.db.product
1617
- webgriffe_sylius_akeneo.behat.context.cli.import_command
@@ -51,6 +52,7 @@ default:
5152
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_product_model
5253
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_family_variant
5354
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute
55+
- webgriffe_sylius_akeneo.behat.context.setup.akeneo_attribute_option
5456

5557
- webgriffe_sylius_akeneo.behat.context.db.product
5658
- webgriffe_sylius_akeneo.behat.context.cli.import_command

0 commit comments

Comments
 (0)