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

Product images deletion fix #9906

Merged
merged 4 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Scenario reproducing the bug
  • Loading branch information
Zales0123 committed Nov 12, 2018
commit 00bba70f9d9696a8ead61496f33d89ac48c91d8e
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ Feature: Prevent deletion of purchased product
When I try to delete the "Toyota GT86 model" product
Then I should be notified that this product is in use and cannot be deleted
And this product should still exist in the product catalog

@ui
Scenario: Purchased product images should be kept
Given the store has a product "Lamborghini Gallardo Model"
And this product has an image "lamborghini.jpg" with "thumbnail" type
And there is a customer "jane.doe@gmail.com" that placed an order "#00000026"
And the customer bought a single "Lamborghini Gallardo Model"
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
When I try to delete the "Lamborghini Gallardo Model" product
Then I should be notified that this product is in use and cannot be deleted
And this product should still exist in the product catalog
And the product "Lamborghini Gallardo Model" should have an image with "thumbnail" type
14 changes: 11 additions & 3 deletions src/Sylius/Behat/Context/Ui/Admin/ManagingProductsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,19 @@ public function iRemoveAnAssociatedProductFromProductAssociation(
}

/**
* @Then /^(?:this product|the product "[^"]+"|it) should(?:| also) have an image with "([^"]*)" type$/
* @Then /^(this product) should(?:| also) have an image with "([^"]*)" type$/
* @Then /^the (product "[^"]+") should(?:| also) have an image with "([^"]*)" type$/
* @Then /^(it) should(?:| also) have an image with "([^"]*)" type$/
*/
public function thisProductShouldHaveAnImageWithType($type)
public function thisProductShouldHaveAnImageWithType(ProductInterface $product, $type)
{
$currentPage = $this->resolveCurrentPage();
if ($product->isSimple()) {
$currentPage = $this->updateSimpleProductPage;
} else {
$currentPage = $this->updateConfigurableProductPage;
}

$currentPage->open(['id' => $product->getId()]);

Assert::true($currentPage->isImageWithTypeDisplayed($type));
}
Expand Down