-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1990 from dpfaffenbauer/features/variant
[Variants] introduce Variant Bundle
- Loading branch information
Showing
160 changed files
with
5,515 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@domain @product @variant | ||
Feature: Adding a Attributes | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
|
||
Scenario: Create a Color Attribute Group | ||
Given the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group | ||
Then the attribute group "Color" should have 3 attributes | ||
|
||
Scenario: Create a Value Attribute Group | ||
Given the site has a attribute group "Size" | ||
And the site has a value attribute "S" in attribute group | ||
And the site has a value attribute "M" in attribute group | ||
And the site has a value attribute "L" in attribute group | ||
And the site has a value attribute "XL" in attribute group | ||
And the site has a value attribute "XXL" in attribute group | ||
Then the attribute group "Size" should have 5 attributes | ||
|
||
Scenario: Create multiple Attribute Group | ||
Given the site has a attribute group "Size" | ||
And the site has a value attribute "S" in attribute group | ||
And the site has a value attribute "M" in attribute group | ||
And the site has a value attribute "L" in attribute group | ||
And the site has a value attribute "XL" in attribute group | ||
And the site has a value attribute "XXL" in attribute group | ||
Then the attribute group "Size" should have 5 attributes | ||
Given the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group | ||
Then the attribute group "Color" should have 3 attributes | ||
Given the site has a attribute group "Season" | ||
And the site has a value attribute "Winter" in attribute group | ||
And the site has a value attribute "Summer" in attribute group | ||
Then the attribute group "Season" should have 2 attributes |
23 changes: 23 additions & 0 deletions
23
features/domain/product/variant/adding_product_with_variants.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@domain @product @variant | ||
Feature: Adding a new Product with Variants | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group | ||
|
||
Scenario: Create a new product with 3 variants | ||
Given the site has a product "Shoe" priced at 100 | ||
And the product is allowed attribute group "Color" | ||
And the product has a variant "red" | ||
And the variant uses attribute color "red" | ||
And the variant is published | ||
And the product has a variant "blue" | ||
And the variant uses attribute color "blue" | ||
And the variant is published | ||
And the product has a variant "green" | ||
And the variant uses attribute color "green" | ||
And the variant is published | ||
Then the product should have 3 variants |
29 changes: 29 additions & 0 deletions
29
features/ui/frontend/product/variant/select_2_level_variant.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@ui @product | ||
Feature: Viewing a product variant details | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the store "Austria" is the default store | ||
And the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group | ||
And the site has a attribute group "Size" | ||
And the site has a value attribute "S" in attribute group | ||
And the site has a value attribute "M" in attribute group | ||
And the site has a value attribute "L" in attribute group | ||
And the site has a value attribute "XL" in attribute group | ||
And the site has a product "T-Shirt" | ||
And the product is active and published and available for store "Austria" | ||
And the product has variants for all values of attribute group "Color" and attribute group "Size" | ||
When I open the variant's detail page | ||
Then I should see the product name "T-Shirt red XL" | ||
|
||
Scenario: View product and select other variant | ||
When I click on attribute color "green" | ||
And attribute value "S" is not selected | ||
And attribute value "M" is not selected | ||
And attribute value "L" is not selected | ||
And attribute value "XL" is not selected | ||
When I click on attribute value "S" | ||
Then I should be on the detail page for variant with key "t-shirt-green-s" |
33 changes: 33 additions & 0 deletions
33
features/ui/frontend/product/variant/select_2_level_variant_without_all_available.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@ui @product | ||
Feature: Viewing a product variant details | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the store "Austria" is the default store | ||
And the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a attribute group "Size" | ||
And the site has a value attribute "S" in attribute group | ||
And the site has a value attribute "M" in attribute group | ||
And the site has a product "T-Shirt" | ||
And the product is active and published and available for store "Austria" | ||
And the product is allowed attribute group "Color" | ||
And the product is allowed attribute group "Size" | ||
And the product has a variant "blue-s" | ||
And the variant uses attribute color "blue" and attribute value "s" | ||
And the variant is published | ||
And the product has a variant "red-s" | ||
And the variant uses attribute color "red" and attribute value "s" | ||
And the variant is published | ||
And the product has a variant "red-m" | ||
And the variant uses attribute color "red" and attribute value "m" | ||
And the variant is published | ||
When I open the variant's detail page | ||
Then I should see the product name "red-m" | ||
|
||
Scenario: View product and select other variant | ||
When I click on attribute color "blue" | ||
Then attribute value "M" is disabled | ||
Then attribute value "S" is enabled | ||
And attribute color "red" is enabled |
41 changes: 41 additions & 0 deletions
41
features/ui/frontend/product/variant/select_3_level_variant.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@ui @product @wip | ||
Feature: Viewing a product variant details | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the store "Austria" is the default store | ||
And the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group with sorting 1 | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group with sorting 2 | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group with sorting 3 | ||
And the site has a attribute group "Size" | ||
And the site has a value attribute "S" in attribute group with sorting 1 | ||
And the site has a value attribute "M" in attribute group with sorting 2 | ||
And the site has a value attribute "L" in attribute group with sorting 3 | ||
And the site has a value attribute "XL" in attribute group with sorting 4 | ||
And the site has a attribute group "Season" | ||
And the site has a value attribute "Winter" in attribute group with sorting 1 | ||
And the site has a value attribute "Summer" in attribute group with sorting 2 | ||
And the site has a product "T-Shirt" | ||
And the product is active and published and available for store "Austria" | ||
And the product has variants for all values of attribute group "Color" and attribute group "Size" and attribute group "Season" | ||
When I open the variant's detail page | ||
Then I should see the product name "T-Shirt red XL Winter" | ||
|
||
Scenario: View product and select other variant | ||
When I click on attribute color "green" | ||
And attribute value "S" is not selected | ||
And attribute value "M" is not selected | ||
And attribute value "L" is not selected | ||
And attribute value "XL" is not selected | ||
And attribute value "Summer" is not selected | ||
And attribute value "Winter" is not selected | ||
When I click on attribute value "S" | ||
And attribute value "Summer" is not selected | ||
And attribute value "Winter" is not selected | ||
When I click on attribute value "Winter" | ||
Then I should be on the detail page for variant with key "t-shirt-green-s-winter" | ||
When I click on attribute color "blue" | ||
When I click on attribute value "XL" | ||
When I click on attribute value "Summer" | ||
Then I should be on the detail page for variant with key "t-shirt-blue-xl-summer" |
28 changes: 28 additions & 0 deletions
28
features/ui/frontend/product/variant/select_simple_variant.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@ui @product | ||
Feature: Viewing a product variant details | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the store "Austria" is the default store | ||
And the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group | ||
And the site has a product "T-Shirt" | ||
And the product is active and published and available for store "Austria" | ||
And the product is allowed attribute group "Color" | ||
And the product has a variant "red" | ||
And the variant uses attribute color "red" | ||
And the variant is published | ||
And the product has a variant "blue" | ||
And the variant uses attribute color "blue" | ||
And the variant is published | ||
And the product has a variant "green" | ||
And the variant uses attribute color "green" | ||
And the variant is published | ||
When I open the variant's detail page | ||
Then I should see the product name "green" | ||
|
||
Scenario: View product and select other variant | ||
When I click on attribute color "red" | ||
Then I should be on the detail page for variant with key "red" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@ui @product | ||
Feature: Viewing a product variant details | ||
|
||
Background: | ||
Given the site operates on a store in "Austria" | ||
And the store "Austria" is the default store | ||
And the site has a attribute group "Color" | ||
And the site has a color attribute "red" with hex code "#FF0000" in attribute group | ||
And the site has a color attribute "blue" with hex code "#0000FF" in attribute group | ||
And the site has a color attribute "green" with hex code "#00FF00" in attribute group | ||
|
||
Scenario: View product and check if selected | ||
Given the site has a product "T-Shirt" | ||
And the product is active and published and available for store "Austria" | ||
And the product is allowed attribute group "Color" | ||
And the product has a variant "red" | ||
And the variant uses attribute color "red" | ||
And the variant is published | ||
And the product has a variant "blue" | ||
And the variant uses attribute color "blue" | ||
And the variant is published | ||
And the product has a variant "green" | ||
And the variant uses attribute color "green" | ||
And the variant is published | ||
When I open the variant's detail page | ||
Then I should see the product name "green" | ||
And attribute color "green" is selected | ||
And attribute color "red" is not selected | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* CoreShop. | ||
* | ||
* This source file is subject to the GNU General Public License version 3 (GPLv3) | ||
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt | ||
* files that are distributed with this source code. | ||
* | ||
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) | ||
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreShop\Behat\Context\Domain; | ||
|
||
use Behat\Behat\Context\Context; | ||
use CoreShop\Behat\Service\SharedStorageInterface; | ||
use CoreShop\Component\Core\Model\ProductInterface; | ||
use CoreShop\Component\Taxation\Model\TaxRuleGroupInterface; | ||
use CoreShop\Component\Variant\Model\AttributeGroupInterface; | ||
use Pimcore\Model\DataObject\AbstractObject; | ||
use Pimcore\Model\DataObject\Concrete; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class VariantContext implements Context | ||
{ | ||
public function __construct(protected SharedStorageInterface $sharedStorage) | ||
{ | ||
} | ||
|
||
/** | ||
* @Then /^the (attribute group "[^"]+") should have (\d+) attributes$/ | ||
*/ | ||
public function theAttributeGroupShouldHaveXAttributes(AttributeGroupInterface $attributeGroup, int $count): void | ||
{ | ||
Assert::eq( | ||
count($attributeGroup->getChildren([AbstractObject::OBJECT_TYPE_OBJECT])), | ||
$count, | ||
sprintf( | ||
'%d attributes have been found in group "%s".', | ||
count($attributeGroup->getChildren([AbstractObject::OBJECT_TYPE_OBJECT])), | ||
$attributeGroup->getRealFullPath() | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* @Then /^the (product "[^"]+") should have (\d+) variants$/ | ||
* @Then /^the (product) should have (\d+) variants$/ | ||
*/ | ||
public function theProductShouldHaveVariants(ProductInterface $product, int $count): void | ||
{ | ||
Assert::eq(count($product->getChildren([AbstractObject::OBJECT_TYPE_VARIANT], true)), $count); | ||
} | ||
|
||
} |
Oops, something went wrong.