-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-71520: Product Grid filtered to Store View is broken if corre…
…sponding Store is deleted - fixing grid to render and reset filters if filters will throw an exception - covering with functional tests
- Loading branch information
Showing
10 changed files
with
510 additions
and
8 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
39 changes: 39 additions & 0 deletions
39
...ests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductGridIsRendered.php
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 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Catalog\Test\Constraint; | ||
|
||
/** | ||
* Assert that product grid is rendered correctly. | ||
*/ | ||
class AssertProductGridIsRendered extends \Magento\Mtf\Constraint\AbstractConstraint | ||
{ | ||
/** | ||
* Assert that product grid is rendered correctly. | ||
* | ||
* @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex $catalogProductIndex | ||
* @return void | ||
*/ | ||
public function processAssert( | ||
\Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex $catalogProductIndex | ||
) { | ||
$productId = $catalogProductIndex->open()->getProductGrid()->getFirstItemId(); | ||
\PHPUnit_Framework_Assert::assertNotNull( | ||
$productId, | ||
'Product grid is not rendered correctly.' | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Product grid is rendered correctly.'; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertResetFilterMessage.php
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,38 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Catalog\Test\Constraint; | ||
|
||
/** | ||
* Assert that filters have been reset successfully. | ||
*/ | ||
class AssertResetFilterMessage extends \Magento\Mtf\Constraint\AbstractConstraint | ||
{ | ||
/** | ||
* Assert message that filters have been reset. | ||
* | ||
* @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex $catalogProductIndex | ||
* @return void | ||
*/ | ||
public function processAssert( | ||
\Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex $catalogProductIndex | ||
) { | ||
\PHPUnit_Framework_Assert::assertContains( | ||
'restored the filter to its original state', | ||
$catalogProductIndex->getMessagesBlock()->getErrorMessage() | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Filters have been reset successfully.'; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...tional/tests/app/Magento/Catalog/Test/TestCase/Product/GridFilteringDeletedEntityTest.xml
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,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> | ||
<testCase name="Magento\Ui\Test\TestCase\GridFilteringDeletedEntityTest" summary="Grid filtering by deleted entity" ticketId="MAGETWO-71940"> | ||
<variation name="GridFilteringDeletedEntityTestVariation1"> | ||
<data name="tag" xsi:type="string">severity:S2</data> | ||
<data name="steps" xsi:type="array"> | ||
<item name="0" xsi:type="array"> | ||
<item name="0" xsi:type="string">Magento\Store\Test\TestStep\DeleteWebsitesEntityStep</item> | ||
</item> | ||
</data> | ||
<data name="fixtureName" xsi:type="string">catalogProductSimple</data> | ||
<data name="fixtureDataSet" xsi:type="string">product_with_additional_website</data> | ||
<data name="filters" xsi:type="array"> | ||
<item name="0" xsi:type="array"> | ||
<item name="name" xsi:type="string">:name</item> | ||
</item> | ||
</data> | ||
<data name="pageClass" xsi:type="string">Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex</data> | ||
<data name="gridRetriever" xsi:type="string">getProductGrid</data> | ||
<constraint name="\Magento\Catalog\Test\Constraint\AssertProductGridIsRendered"/> | ||
<constraint name="Magento\Catalog\Test\Constraint\AssertResetFilterMessage"/> | ||
</variation> | ||
</testCase> | ||
</config> |
Oops, something went wrong.