Skip to content

Commit

Permalink
fix failing scenarios by adding missing isset and shop associations
Browse files Browse the repository at this point in the history
  • Loading branch information
zuk3975 committed Feb 1, 2023
1 parent b433710 commit d7ed7d6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Adapter/Attribute/Repository/AttributeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function assertExistsInEveryShop(array $attributeIds, array $shopIds): vo
}

foreach ($attributeIdValues as $attributeIdValue) {
if ($attributeShops[$attributeIdValue] !== $shopIdValues) {
if (!isset($attributeShops[$attributeIdValue]) || $attributeShops[$attributeIdValue] !== $shopIdValues) {
throw new ShopAssociationNotFound('Provided attributes do not exist in every shop');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function assertExistsInEveryShop(array $attributeGroupIds, array $shopIds
}

foreach ($attributeGroupIdValues as $attributeGroupIdValue) {
if ($attributeGroupShops[$attributeGroupIdValue] !== $shopIdValues) {
if (!isset($attributeGroupShops[$attributeGroupIdValue]) || $attributeGroupShops[$attributeGroupIdValue] !== $shopIdValues) {
throw new ShopAssociationNotFound('Provided attribute groups does not exist in every shop');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function assertNamedAttributeExists(string $attributeReference, string $n
}

/**
* @Given I associate attribute ":attributeReference" with shops ":shopReferences"
* @Given /^I associate attribute "(.+)" with shops "(.+)"$/
*
* @param string $attributeReference
* @param string $shopReferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function assertNamedAttributeGroupExists(string $attributeGroupReference,
}

/**
* @Given I associate attribute group ":attributeGroupReference" with shops ":shopReferences"
* @Given /^I associate attribute group "(.+)" with shops "(.+)"$/
*
* @param string $attributeGroupReference
* @param string $shopReferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ Feature: Copy product from shop to shop.
And I add a shop "shop3" with name "test_third_shop" and color "blue" for the group "test_second_shop_group"
And I add a shop "shop4" with name "test_shop_without_url" and color "blue" for the group "test_second_shop_group"
And single shop context is loaded
And I associate attribute group "Size" with shops "shop1,shop2,shop3,shop4"
And I associate attribute group "Color" with shops "shop1,shop2,shop3,shop4"
And I associate attribute "S" with shops "shop1,shop2,shop3,shop4"
And I associate attribute "M" with shops "shop1,shop2,shop3,shop4"
And I associate attribute "L" with shops "shop1,shop2,shop3,shop4"
And I associate attribute "White" with shops "shop1,shop2,shop3,shop4"
And I associate attribute "Black" with shops "shop1,shop2,shop3,shop4"
And I associate attribute "Blue" with shops "shop1,shop2,shop3,shop4"
And language "french" with locale "fr-FR" exists
And I add product "standardProduct" to shop "shop2" with following information:
| name[en-US] | magic staff |
Expand Down

0 comments on commit d7ed7d6

Please sign in to comment.