Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Admin][ProductAssociation] Adding associated products to a product #6642

Merged
merged 11 commits into from
Nov 10, 2016

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented Nov 7, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Related tickets -
License MIT

@GSadee GSadee changed the title [WIP][Admin][ProductAssociation] Adding associated products of a product [WIP][Admin][ProductAssociation] Adding associated products to a product Nov 7, 2016
And I remove an associated product "LG earphones" from "Accessories"
And I add it
Then I should be notified that it has been successfully created
And this product should have an association "Accessories" with product "LG headphones"
Copy link
Contributor

@michalmarcinkowski michalmarcinkowski Nov 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing And this product should not have an association "Accessories" with product "LG earphones"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 👍

And I remove an associated product "LG earphones" from "Accessories"
And I save my changes
Then I should be notified that it has been successfully edited
And this product should have an association "Accessories" with product "LG headphones"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this product should not have an association "Accessories" with product "LG earphones"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 👍

'%association%' => $productAssociationType->getName(),
'%item%' => $productName,
]);
$item->find('css', 'i.delete')->click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find can return null we should assert before click

@michalmarcinkowski
Copy link
Contributor

@GSadee rebase required.

@GSadee GSadee changed the title [WIP][Admin][ProductAssociation] Adding associated products to a product [Admin][ProductAssociation] Adding associated products to a product Nov 9, 2016
@GSadee GSadee force-pushed the admin-associated-products branch 2 times, most recently from e35193c to 3286609 Compare November 10, 2016 08:14
$this->setProductAssociations($productAssociations);

if (null === $productAssociations) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By convention of DataTransformerInterface, this should be return '';

/**
* @Given /^the (product "[^"]+") has(?:| also) an (association "[^"]+") with (product "[^"]+")$/
*/
public function theProductHasAnAssociationWithProduct(
Copy link
Member

@lchrusciel lchrusciel Nov 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could be merged with the method below if we would use variadics

) {
/** @var UpdateSimpleProductPageInterface|UpdateConfigurableProductPageInterface $currentPage */
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([
$this->createSimpleProductPage,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the assosciation work only on simple product page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that testing that also on configurable product page has a business value, because the logic is the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but we have generic steep, which can be used with both with simple or configurable product.

/**
* @var FactoryInterface
*/
protected $productAssociationFactory;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class is final so methods should be private

@michalmarcinkowski michalmarcinkowski merged commit 76aebc5 into Sylius:master Nov 10, 2016
@michalmarcinkowski
Copy link
Contributor

Good job Grzesiu! 👍

@GSadee GSadee deleted the admin-associated-products branch September 22, 2017 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants