From a41f0e894da7eb361d00219c400b7cfbcbb600bc Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Tue, 31 May 2016 18:16:37 +0300 Subject: [PATCH 01/22] MAGETWO-51688: Missing Translations in Product menus --- .../view/adminhtml/ui_component/category_form.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml index 8b8c5bd7adc9e..85793a2073d76 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml @@ -185,6 +185,7 @@ ui/form/field category + Description true description 50 @@ -217,6 +218,7 @@ 70 string select + Display Mode @@ -244,7 +246,6 @@ Magento_Ui/js/form/components/group true 90 - Sort Products By @@ -253,6 +254,7 @@ admin__field-default multiselect category + Available Product Listing Sort By @@ -279,7 +281,6 @@ true Magento_Ui/js/form/components/group - Default Product Sorting true 100 @@ -290,6 +291,7 @@ admin__field-default select category + Default Product Listing Sort By @@ -316,7 +318,6 @@ true Magento_Ui/js/form/components/group - Layered Navigation Price Step true 110 @@ -327,6 +328,7 @@ admin__field-small input category + Layered Navigation Price Step $ @@ -362,7 +364,6 @@ group Magento_Ui/js/form/components/group - URL Key false 120 @@ -372,6 +373,7 @@ input category + URL Key 10 ${ $.provider }:data.use_default.url_key From 18e8998b87f4049d705e875d83d461915d208fca Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Thu, 2 Jun 2016 19:19:29 +0300 Subject: [PATCH 02/22] MAGETWO-53296: Customer Reviews Report does not work with DB with prefixes --- .../Reports/Model/ResourceModel/Review/Customer/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Review/Customer/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Review/Customer/Collection.php index 51eae4a970cf8..50b570cc366ee 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Review/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Review/Customer/Collection.php @@ -83,7 +83,7 @@ protected function _joinCustomers() $this->getSelect()->reset( \Magento\Framework\DB\Select::COLUMNS )->joinInner( - ['customer' => $connection->getTableName('customer_entity')], + ['customer' => $this->getTable('customer_entity')], 'customer.entity_id = detail.customer_id', [] )->columns( From 5098a05942316e1010f69ab6f9995f9068d656a5 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Mon, 6 Jun 2016 12:58:03 +0300 Subject: [PATCH 03/22] MAGETWO-53926: [FT] Improve error reporting on Bamboo --- .../Catalog/Test/Constraint/AssertCategoryPage.php | 6 ++++++ .../TestCase/Product/DeleteCompareProductsTest.xml | 4 ++-- .../AssertCatalogPriceRuleAppliedOnepageCheckout.php | 2 ++ .../AssertCatalogPriceRuleAppliedShoppingCart.php | 2 ++ .../Test/TestCase/ViewedProductsReportEntityTest.php | 11 +++++++++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php index ab016aaa882c3..045273dc71f7f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php @@ -202,6 +202,12 @@ protected function verifyDisplaySettings(array $categoryData) { $errorMessage = []; + if (!$this->categoryViewPage->getTopToolbar()->isVisible()) { + $errorMessage[] = + 'Top toolbar is expected on category page, but not displayed. Skipped verifying display settings.'; + return $errorMessage; + } + //TODO: verify display_mode if (isset($categoryData['default_sort_by'])) { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml index d2e437b994e5f..883e7cdf6032c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DeleteCompareProductsTest.xml @@ -7,14 +7,14 @@ --> - + catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product 1 No - + catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product 6 Yes diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php index 7b4028e8029b2..bee31130bec3c 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php @@ -67,6 +67,8 @@ public function processAssert( $expectedPrices, $actualPrices, 'Wrong total cart prices are displayed.' + . "\nExpected: " . implode(PHP_EOL, $expectedPrices) + . "\nActual: " . implode(PHP_EOL, $actualPrices) . "\n" ); } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php index 4570814dc9d27..08721cf49238f 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php @@ -68,6 +68,8 @@ public function processAssert( $expectedPrices, $actualPrices, 'Wrong total cart prices are displayed.' + . "\nExpected: " . implode(PHP_EOL, $expectedPrices) + . "\nActual: " . implode(PHP_EOL, $actualPrices) . "\n" ); } diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php index 0f353c38b6f34..3f45a0541fe7c 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php @@ -11,6 +11,7 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Reports\Test\Page\Adminhtml\ProductReportView; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; +use Magento\Cms\Test\Page\CmsIndex; /** * Preconditions: @@ -62,10 +63,17 @@ class ViewedProductsReportEntityTest extends Injectable * @var CatalogProductIndex */ protected $catalogProductIndexPage; + /** + * Catalog product index page + * + * @var CmsIndex + */ + protected $cmsIndex; /** * Inject pages * + * @param CmsIndex $cmsIndex * @param ProductReportView $productReportView * @param FixtureFactory $fixtureFactory * @param BrowserInterface $browser @@ -73,11 +81,13 @@ class ViewedProductsReportEntityTest extends Injectable * @return void */ public function __inject( + CmsIndex $cmsIndex, ProductReportView $productReportView, FixtureFactory $fixtureFactory, BrowserInterface $browser, CatalogProductIndex $catalogProductIndexPage ) { + $this->cmsIndex = $cmsIndex; $this->productReportView = $productReportView; $this->fixtureFactory = $fixtureFactory; $this->browser = $browser; @@ -140,6 +150,7 @@ protected function openProducts(array $products, $total) foreach ($products as $key => $product) { for ($i = 0; $i < $total[$key]; $i++) { $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->assertEquals($product->getName(), $this->cmsIndex->getTitleBlock()->getTitle(), 'Could not open product page'); } } } From a77d82e4b77409b5722d2eeca7b33b6f3603e7fb Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Mon, 6 Jun 2016 14:02:01 +0300 Subject: [PATCH 04/22] MAGETWO-53926: [FT] Improve error reporting on Bamboo --- .../tests/app/Magento/Backend/Test/Block/Widget/Grid.php | 2 +- .../app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php | 2 +- .../tests/app/Magento/PageCache/Test/Block/Cache/Grid.php | 2 +- .../Test/Block/Adminhtml/Refresh/Statistics/Grid.php | 2 +- .../Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php | 2 +- .../tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php index 45f4e3427554b..3fbffbf0708c6 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php @@ -293,7 +293,7 @@ public function searchAndSelect(array $filter) if ($selectItem->isVisible()) { $selectItem->click(); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } } diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php index 0a8a18ab57e23..cc89afe1e6134 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php @@ -102,7 +102,7 @@ public function searchAndPreview(array $filter) $rowItem->find($this->selectAction)->click(); $rowItem->find($this->previewCmsPage)->click(); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } } } diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php index ad67b5fb49acf..4398f42cb11f2 100644 --- a/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php @@ -26,7 +26,7 @@ public function searchAndSelect(array $filter) if ($selectItem->isVisible()) { $selectItem->click(); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } } } diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Refresh/Statistics/Grid.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Refresh/Statistics/Grid.php index 2f5bbe75084c1..30853af1345ce 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Refresh/Statistics/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Refresh/Statistics/Grid.php @@ -35,7 +35,7 @@ public function searchAndSelect(array $filter) if ($selectItem->isVisible()) { $selectItem->click(); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php index 00ce972e29fc9..0596428fd57f9 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/StatusGrid.php @@ -54,7 +54,7 @@ public function searchAndUnassign(array $filter) if ($selectItem->isVisible()) { $selectItem->click(); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } } diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 8fce1bb52b967..6485de1e81d43 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -234,7 +234,7 @@ public function searchAndOpen(array $filter) if ($rowItem->isVisible()) { $this->clickEditLink($rowItem); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } $this->waitLoader(); } @@ -252,7 +252,7 @@ public function searchAndSelect(array $filter) if ($rowItem->isVisible()) { $rowItem->find($this->selectItem)->click(); } else { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } $this->waitLoader(); } @@ -354,7 +354,7 @@ public function selectItems(array $items, $isSortable = true) } } while ($this->nextPage()); if (!$selectItem->isVisible()) { - throw new \Exception('Searched item was not found.'); + throw new \Exception("Searched item was not found\n" . print_r($item, true)); } } } From a4db06a640412437df8ee64bf9d5d7e4c61ac7e3 Mon Sep 17 00:00:00 2001 From: Volodymyr Klymenko Date: Mon, 6 Jun 2016 17:46:56 +0300 Subject: [PATCH 05/22] MAGETWO-52653: Simple Product is shown as "Out of stock" on category grid when catalog permissions applied --- .../Magento/Catalog/view/frontend/templates/product/list.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index 324bc105adc72..b2c4dbb5dfcfe 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -89,7 +89,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); - getIsSalable()): ?> + isAvailable()): ?>
From 5886f2d81ca79370a71aa38695e41ef457253a39 Mon Sep 17 00:00:00 2001 From: Mykola Palamar Date: Thu, 9 Jun 2016 18:33:38 +0300 Subject: [PATCH 06/22] MAGETWO-53056: Category tree is not refreshed after changing category URL suffix --- .../Backend/Catalog/Url/Rewrite/Suffix.php | 25 ++++ .../Catalog/Url/Rewrite/SuffixTest.php | 138 ++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index 2ec8137d768bf..c399ef063fcd3 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -93,10 +93,35 @@ public function afterSave() { if ($this->isValueChanged()) { $this->updateSuffixForUrlRewrites(); + if ($this->isCategorySuffixChanged()) { + $this->invalidateCategoryRelatedCache(); + } } return parent::afterSave(); } + /** + * Check is category suffix changed + * + * @return bool + */ + protected function isCategorySuffixChanged() + { + return $this->isValueChanged() + && ($this->getPath() == CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX); + } + + /** + * Invalidate cache that store old category suffix + */ + protected function invalidateCategoryRelatedCache() + { + $this->cacheTypeList->invalidate([ + \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER, + \Magento\Framework\App\Cache\Type\Collection::TYPE_IDENTIFIER + ]); + } + /** * Update suffix for url rewrites * diff --git a/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php b/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php new file mode 100644 index 0000000000000..7aa3b9dcd6f9e --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php @@ -0,0 +1,138 @@ +eventDispatcher = $this->getMockBuilder('\Magento\Framework\Event\ManagerInterface') + ->disableOriginalConstructor() + ->setMethods(['dispatch']) + ->getMock(); + $this->eventDispatcher->method('dispatch')->willReturnSelf(); + $this->context = $this->getMockBuilder('\Magento\Framework\Model\Context') + ->disableOriginalConstructor() + ->setMethods(['getEventDispatcher']) + ->getMock(); + $this->context->method('getEventDispatcher')->willReturn($this->eventDispatcher); + + $this->registry = $this->getMock('\Magento\Framework\Registry'); + $this->config = $this->getMock('\Magento\Framework\App\Config\ScopeConfigInterface'); + $this->cacheTypeList = $this->getMockBuilder('\Magento\Framework\App\Cache\TypeList') + ->disableOriginalConstructor() + ->setMethods(['invalidate']) + ->getMock(); + + $this->urlRewriteHelper = $this->getMockBuilder('\Magento\UrlRewrite\Helper\UrlRewrite') + ->disableOriginalConstructor() + ->getMock(); + $this->storeManager = $this->getMockBuilder('\Magento\Store\Model\StoreManager') + ->disableOriginalConstructor() + ->setMethods(['getStores']) + ->getMock(); + $this->storeManager->method('getStores')->willReturn([]); + + $this->appResource =$this->getMockBuilder('\Magento\Framework\App\ResourceConnection') + ->disableOriginalConstructor() + ->getMock(); + $this->urlFinder =$this->getMockBuilder('\Magento\UrlRewrite\Model\UrlFinderInterface') + ->setMethods(['findAllByData', 'findOneByData']) + ->getMock(); + $this->urlFinder->method('findAllByData')->willReturn([]); + + $this->suffixModel = new \Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix( + $this->context, + $this->registry, + $this->config, + $this->cacheTypeList, + $this->urlRewriteHelper, + $this->storeManager, + $this->appResource, + $this->urlFinder + ); + } + + public function testAfterSaveCleanCache() + { + $this->suffixModel->setValue('new'); + $this->suffixModel->setPath(\Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX); + $this->cacheTypeList->expects($this->exactly(2))->method('invalidate')->withConsecutive( + [$this->equalTo([ + \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER, + \Magento\Framework\App\Cache\Type\Collection::TYPE_IDENTIFIER + ])], + [$this->equalTo('config')] + ); + $this->suffixModel->afterSave(); + } + + public function testAfterSaveWithoutChanges() + { + $this->suffixModel->setValue(''); + $this->suffixModel->setPath(\Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX); + $this->cacheTypeList->expects($this->never())->method('invalidate'); + $this->suffixModel->afterSave(); + } + + public function testAfterSaveProduct() + { + $this->suffixModel->setValue('new'); + $this->suffixModel->setPath(\Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator::XML_PATH_PRODUCT_URL_SUFFIX); + $this->cacheTypeList->expects($this->once())->method('invalidate')->with('config'); + $this->suffixModel->afterSave(); + } +} \ No newline at end of file From b065cd3e7201c1f7b0b45efe29020662d15ad9f1 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Thu, 9 Jun 2016 20:15:40 +0300 Subject: [PATCH 07/22] MAGETWO-53036: [GITHUB] Base image placeholder issue #4549 --- app/code/Magento/Catalog/Block/Product/View/Gallery.php | 6 +++--- app/code/Magento/Catalog/Helper/Image.php | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 7f4ad758fa713..0edeba7d807ac 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -121,9 +121,9 @@ public function getGalleryImagesJson() } if (empty($imagesItems)) { $imagesItems[] = [ - 'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'), - 'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'), - 'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'), + 'thumb' => $this->getImage($this->getProduct(), 'product_thumbnail_image')->getImageUrl(), + 'img' => $this->getImage($this->getProduct(), 'product_base_image')->getImageUrl(), + 'full' => $this->getImage($this->getProduct(), 'product_page_image_large')->getImageUrl(), 'caption' => '', 'position' => '0', 'isMain' => true, diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index e29b0496d1779..eb5e7142d3094 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -433,6 +433,9 @@ public function placeholder($fileName) * * @param null|string $placeholder * @return string + * + * @deprecated Returns only default placeholder. + * Does not take into account custom placeholders set in Configuration. */ public function getPlaceholder($placeholder = null) { @@ -544,6 +547,9 @@ public function getResizedImageInfo() /** * @param null|string $placeholder * @return string + * + * @deprecated Returns only default placeholder. + * Does not take into account custom placeholders set in Configuration. */ public function getDefaultPlaceholderUrl($placeholder = null) { From 86a394f1dd9b4636e4743f512e78f29f24bbcae9 Mon Sep 17 00:00:00 2001 From: Mykola Palamar Date: Fri, 10 Jun 2016 01:53:59 +0300 Subject: [PATCH 08/22] MAGETWO-53056: Category tree is not refreshed after changing category URL suffix - fixed CR notes --- .../Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index c399ef063fcd3..a04796c8e2b39 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -113,6 +113,8 @@ protected function isCategorySuffixChanged() /** * Invalidate cache that store old category suffix + * + * @return void */ protected function invalidateCategoryRelatedCache() { From 8e073047adad4ae40aa306b51e103296a2faba84 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Sat, 11 Jun 2016 18:08:12 +0300 Subject: [PATCH 09/22] MAGETWO-54282: [FT] Improve error reporting on Bamboo #2 --- .../Constraint/AssertBundleProductPage.php | 3 + .../Test/Constraint/AssertCategoryPage.php | 7 ++ .../Test/Constraint/AssertProductPage.php | 79 +++++++++++-------- .../AssertConfigurableProductPage.php | 3 + 4 files changed, 60 insertions(+), 32 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php index 47a424af9fbd8..704404e665ac1 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php @@ -25,6 +25,9 @@ protected function verifyPrice() $priceData = $this->product->getDataFieldConfig('price')['source']->getPriceData(); $priceView = $this->product->getPriceView(); $priceBlock = $this->productView->getPriceBlock(); + if (!$priceBlock->isVisible()) { + return "Price block for '{$this->product->getName()}' product' is not visible."; + } if ($this->product->hasData('special_price')) { $priceLow = $priceBlock->getPrice(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php index ab016aaa882c3..9884d0c3f4115 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php @@ -161,6 +161,13 @@ protected function verifyContent(array $categoryData) { $errorMessage = []; + if (!$this->categoryViewPage->getViewBlock()->isVisible()) { + $errorMessage[] = + 'Category Content is not visible.' + . "Skipped verifying Content settings for category {$categoryData['name']}."; + return $errorMessage; + } + if (isset($categoryData['description'])) { $description = $this->categoryViewPage->getViewBlock()->getDescription(); if ($categoryData['description'] != $description) { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php index 928c89e29ffb5..bfc39fc5d0e8d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php @@ -82,20 +82,24 @@ protected function verify() } /** - * Verify displayed product name on product page(front-end) equals passed from fixture + * Verify displayed product name on Storefront product page equals to the passed from fixture * * @return string|null */ protected function verifyName() { - $fixtureProductName = $this->product->getName(); - $formProductName = $this->productView->getProductName(); + $expectedName = $this->product->getName(); + try { + $actualName = $this->productView->getProductName(); + } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { + return "Could not found product '{$this->product->getName()}' name on the page.\n" . $e->getMessage(); + } - if ($fixtureProductName == $formProductName) { + if ($expectedName == $actualName) { return null; } - return "Displayed product name on product page(front-end) not equals passed from fixture. " - . "Actual: {$formProductName}, expected: {$fixtureProductName}."; + return "Product name on Storefront product '{$this->product->getName()}' page is unexpected. " + . "Actual: {$actualName}, expected: {$expectedName}."; } /** @@ -110,12 +114,15 @@ protected function verifyPrice() } $priceBlock = $this->productView->getPriceBlock(); - $formPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(); - $fixturePrice = number_format($this->product->getPrice(), 2, '.', ''); + if (!$priceBlock->isVisible()) { + return "Price block for '{$this->product->getName()}' product' is not visible."; + } + $actualPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(); + $expectedPrice = number_format($this->product->getPrice(), 2, '.', ''); - if ($fixturePrice != $formPrice) { - return "Displayed product price on product page(front-end) not equals passed from fixture. " - . "Actual: {$fixturePrice}, expected: {$formPrice}."; + if ($expectedPrice != $actualPrice) { + return "Displayed product price on Storefront product '{$this->product->getName()}' page is unexpected. " + . "Actual: {$actualPrice}, expected: {$expectedPrice}."; } return null; } @@ -130,14 +137,18 @@ protected function verifySpecialPrice() if (!$this->product->hasData('special_price')) { return null; } - $fixtureProductSpecialPrice = $this->product->getSpecialPrice(); - $fixtureProductSpecialPrice = number_format($fixtureProductSpecialPrice, 2); - $formProductSpecialPrice = $this->productView->getPriceBlock()->getSpecialPrice(); - if ($fixtureProductSpecialPrice == $formProductSpecialPrice) { + $expectedSpecialPrice = $this->product->getSpecialPrice(); + $expectedSpecialPrice = number_format($expectedSpecialPrice, 2); + $priceBlock = $this->productView->getPriceBlock(); + if (!$priceBlock->isVisible()) { + return "Price block for '{$this->product->getName()}' product' is not visible."; + } + $actualSpecialPrice = $priceBlock->getSpecialPrice(); + if ($expectedSpecialPrice == $actualSpecialPrice) { return null; } - return "Displayed product special price on product page(front-end) not equals passed from fixture. " - . "Actual: {$formProductSpecialPrice}, expected: {$fixtureProductSpecialPrice}."; + return "Displayed product special price on Storefront product '{$this->product->getName()}' page is unexpected." + . "Actual: {$actualSpecialPrice}, expected: {$expectedSpecialPrice}."; } /** @@ -147,14 +158,18 @@ protected function verifySpecialPrice() */ protected function verifySku() { - $fixtureProductSku = $this->product->getSku(); - $formProductSku = $this->productView->getProductSku(); + $expectedSku = $this->product->getSku(); + try { + $actualSku = $this->productView->getProductSku(); + } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { + return "Could not found product {$this->product->getName()}' SKU on the page.\n" . $e->getMessage(); + } - if ($fixtureProductSku === null || $fixtureProductSku == $formProductSku) { + if ($expectedSku === null || $expectedSku == $actualSku) { return null; } - return "Displayed product sku on product page(front-end) not equals passed from fixture. " - . "Actual: {$formProductSku}, expected: {$fixtureProductSku}."; + return "Displayed product sku on Storefront product '{$this->product->getName()}' page is unexpected. " + . "Actual: {$actualSku}, expected: {$expectedSku}."; } /** @@ -164,14 +179,14 @@ protected function verifySku() */ protected function verifyDescription() { - $fixtureProductDescription = $this->product->getDescription(); - $formProductDescription = $this->productView->getProductDescription(); + $expectedDescription = $this->product->getDescription(); + $actualDescription = $this->productView->getProductDescription(); - if ($fixtureProductDescription === null || $fixtureProductDescription == $formProductDescription) { + if ($expectedDescription === null || $expectedDescription == $actualDescription) { return null; } - return "Displayed product description on product page(front-end) not equals passed from fixture. " - . "Actual: {$formProductDescription}, expected: {$fixtureProductDescription}."; + return "Displayed product description on Storefront product '{$this->product->getName()}' page is unexpected. " + . "Actual: {$actualDescription}, expected: {$expectedDescription}."; } /** @@ -181,14 +196,14 @@ protected function verifyDescription() */ protected function verifyShortDescription() { - $fixtureShortDescription = $this->product->getShortDescription(); - $formProductShortDescription = $this->productView->getProductShortDescription(); + $expected = $this->product->getShortDescription(); + $actual = $this->productView->getProductShortDescription(); - if ($fixtureShortDescription === null || $fixtureShortDescription == $formProductShortDescription) { + if ($expected === null || $expected == $actual) { return null; } - return "Displayed product short description on product page(front-end) not equals passed from fixture. " - . "Actual: {$formProductShortDescription}, expected: {$fixtureShortDescription}."; + return "Displayed short description on Storefront product '{$this->product->getName()}' page is unexpected. " + . "Actual: {$actual}, expected: {$expected}."; } /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductPage.php index cb70e6143afe7..62d6c72efe8c6 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductPage.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductPage.php @@ -41,6 +41,9 @@ protected function verify() protected function verifyPrice() { $priceBlock = $this->productView->getPriceBlock(); + if (!$priceBlock->isVisible()) { + return "Price block for '{$this->product->getName()}' product' is not visible."; + } $formPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(); $fixturePrice = $this->getLowestConfigurablePrice(); From 4c12c838f36b4e4762da5a8e7a3404342a65131b Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Sat, 11 Jun 2016 18:09:07 +0300 Subject: [PATCH 10/22] MAGETWO-54282: [FT] Improve error reporting on Bamboo #2 --- .../tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 8fce1bb52b967..752cf15b4db69 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -300,9 +300,10 @@ public function selectMassAction($massActionSelection) $massActionList = '(' . $this->massActionToggleList . ")[$i]"; if ($this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->isVisible()) { $this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->click(); - $this->_rootElement - ->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH) - ->click(); + $massActionElement = + $this->_rootElement->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH); + $this->waitForElementVisible($massActionElement); + $massActionElement->click(); break; } } From fcbe398f21f5c4ef3af858f99a2dca5cab895008 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Sat, 11 Jun 2016 18:12:25 +0300 Subject: [PATCH 11/22] MAGETWO-54282: [FT] Improve error reporting on Bamboo #2 --- .../tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php index 752cf15b4db69..8fce1bb52b967 100644 --- a/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php +++ b/dev/tests/functional/tests/app/Magento/Ui/Test/Block/Adminhtml/DataGrid.php @@ -300,10 +300,9 @@ public function selectMassAction($massActionSelection) $massActionList = '(' . $this->massActionToggleList . ")[$i]"; if ($this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->isVisible()) { $this->_rootElement->find($massActionButton, Locator::SELECTOR_XPATH)->click(); - $massActionElement = - $this->_rootElement->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH); - $this->waitForElementVisible($massActionElement); - $massActionElement->click(); + $this->_rootElement + ->find(sprintf($massActionList, $massActionSelection), Locator::SELECTOR_XPATH) + ->click(); break; } } From 2453ddaf094a4f5199d86b7448aa1cd64e0a9f94 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Mon, 13 Jun 2016 16:05:09 +0300 Subject: [PATCH 12/22] MAGETWO-54282: [FT] Improve error reporting on Bamboo #2 --- .../Magento/Catalog/Test/Constraint/AssertProductPage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php index bfc39fc5d0e8d..e99b63d5b8ce7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php @@ -92,7 +92,7 @@ protected function verifyName() try { $actualName = $this->productView->getProductName(); } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { - return "Could not found product '{$this->product->getName()}' name on the page.\n" . $e->getMessage(); + return "Could not find product '{$this->product->getName()}' name on the page.\n" . $e->getMessage(); } if ($expectedName == $actualName) { @@ -162,13 +162,13 @@ protected function verifySku() try { $actualSku = $this->productView->getProductSku(); } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { - return "Could not found product {$this->product->getName()}' SKU on the page.\n" . $e->getMessage(); + return "Could not find product {$this->product->getName()}' SKU on the page.\n" . $e->getMessage(); } if ($expectedSku === null || $expectedSku == $actualSku) { return null; } - return "Displayed product sku on Storefront product '{$this->product->getName()}' page is unexpected. " + return "Displayed product SKU on Storefront product '{$this->product->getName()}' page is unexpected. " . "Actual: {$actualSku}, expected: {$expectedSku}."; } From bffd1c01d5f0ba22719e09af6323a12c186c3803 Mon Sep 17 00:00:00 2001 From: Mykola Palamar Date: Tue, 14 Jun 2016 02:31:35 +0300 Subject: [PATCH 13/22] MAGETWO-54066: [GITHUB] Invalid event prefix for catalog inventory #4857 --- .../Magento/CatalogInventory/Model/Stock.php | 2 +- .../CatalogInventory/Model/Stock/Item.php | 2 +- .../Test/Unit/Model/Stock/ItemTest.php | 46 ++++++ .../Test/Unit/Model/StockTest.php | 132 ++++++++++++++++++ 4 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Test/Unit/Model/StockTest.php diff --git a/app/code/Magento/CatalogInventory/Model/Stock.php b/app/code/Magento/CatalogInventory/Model/Stock.php index 85523616e89cd..1c38e53d1201c 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Stock.php @@ -24,7 +24,7 @@ class Stock extends AbstractExtensibleModel implements StockInterface * * @var string */ - protected $eventPrefix = 'cataloginventory_stock'; + protected $_eventPrefix = 'cataloginventory_stock'; /** * Parameter name in event diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php index 7a84ffec7d1c5..2757f8e5edcf3 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php @@ -32,7 +32,7 @@ class Item extends AbstractExtensibleModel implements StockItemInterface * * @var string */ - protected $eventPrefix = 'cataloginventory_stock_item'; + protected $_eventPrefix = 'cataloginventory_stock_item'; const WEBSITE_ID = 'website_id'; diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php index 7c037f86515fe..5b2c1e3366e02 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php @@ -72,8 +72,18 @@ class ItemTest extends \PHPUnit_Framework_TestCase */ protected $storeId = 111; + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + private $eventDispatcher; + protected function setUp() { + $this->eventDispatcher = $this->getMockBuilder('\Magento\Framework\Event\ManagerInterface') + ->disableOriginalConstructor() + ->setMethods(['dispatch']) + ->getMock(); + $this->context = $this->getMock( '\Magento\Framework\Model\Context', ['getEventDispatcher'], @@ -81,6 +91,7 @@ protected function setUp() '', false ); + $this->context->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventDispatcher); $this->registry = $this->getMock( '\Magento\Framework\Registry', @@ -457,4 +468,39 @@ public function getQtyIncrementsDataProvider() ], ]; } + + /** + * We wan't to ensure that property $_eventPrefix used during event dispatching + * + * @param $eventName + * @param $methodName + * + * @dataProvider eventsDataProvider + */ + public function testDispatchEvents($eventName, $methodName) + { + $isCalledWithRightPrefix = 0; + $this->eventDispatcher->expects($this->any())->method('dispatch')->with( + $this->callback(function($arg) use (&$isCalledWithRightPrefix, $eventName) { + $isCalledWithRightPrefix |= ($arg === $eventName); + return true; + }), + $this->anything() + ); + + $this->item->$methodName(); + $this->assertEquals( + 1, + (int) $isCalledWithRightPrefix, + sprintf("Event %s doesn't dispatched", $eventName) + ); + } + + public function eventsDataProvider() + { + return [ + ['cataloginventory_stock_item_save_before', 'beforeSave'], + ['cataloginventory_stock_item_save_after', 'afterSave'], + ]; + } } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/StockTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/StockTest.php new file mode 100644 index 0000000000000..48c532bba7045 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/StockTest.php @@ -0,0 +1,132 @@ +eventDispatcher = $this->getMockBuilder('\Magento\Framework\Event\ManagerInterface') + ->disableOriginalConstructor() + ->setMethods(['dispatch']) + ->getMock(); + + $this->context = $this->getMockBuilder('\Magento\Framework\Model\Context') + ->disableOriginalConstructor() + ->setMethods(['getEventDispatcher']) + ->getMock(); + $this->context->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventDispatcher); + + $this->registry = $this->getMockBuilder('\Magento\Framework\Registry') + ->disableOriginalConstructor() + ->getMock(); + + $this->extensionFactory = $this->getMockBuilder('Magento\Framework\Api\ExtensionAttributesFactory') + ->disableOriginalConstructor() + ->getMock(); + + $this->customAttributeFactory = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') + ->disableOriginalConstructor() + ->getMock(); + + $this->resource = $this->getMockBuilder('\Magento\Framework\Model\ResourceModel\AbstractResource') + ->disableOriginalConstructor() + ->setMethods(['getIdFieldName']) + ->getMockForAbstractClass(); + + $this->resourceCollection = $this->getMockBuilder('\Magento\Framework\Data\Collection\AbstractDb') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->stockModel = new \Magento\CatalogInventory\Model\Stock( + $this->context, + $this->registry, + $this->extensionFactory, + $this->customAttributeFactory, + $this->resource, + $this->resourceCollection + ); + } + + /** + * We wan't to ensure that property $_eventPrefix used during event dispatching + * + * @param $eventName + * @param $methodName + * + * @dataProvider eventsDataProvider + */ + public function testDispatchEvents($eventName, $methodName) + { + $isCalledWithRightPrefix = 0; + $this->eventDispatcher->expects($this->any())->method('dispatch')->with( + $this->callback(function($arg) use (&$isCalledWithRightPrefix, $eventName) { + $isCalledWithRightPrefix |= ($arg === $eventName); + return true; + }), + $this->anything() + ); + + $this->stockModel->$methodName(); + $this->assertEquals( + 1, + (int) $isCalledWithRightPrefix, + sprintf("Event %s doesn't dispatched", $eventName) + ); + } + + public function eventsDataProvider() + { + return [ + ['cataloginventory_stock_save_before', 'beforeSave'], + ['cataloginventory_stock_save_after', 'afterSave'], + ]; + } +} From aa49004fdddb68f6eb3b457105d8a405b75c3481 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Tue, 14 Jun 2016 13:45:07 +0300 Subject: [PATCH 14/22] MAGETWO-54259: Search in Review grid does not work --- app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index 3421f31a70688..f04d5a436e27b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -114,8 +114,6 @@ protected function _getStore() */ protected function _prepareCollection() { - parent::_prepareCollection(); - $store = $this->_getStore(); $collection = $this->_productFactory->create()->getCollection()->addAttributeToSelect( 'sku' @@ -184,6 +182,9 @@ protected function _prepareCollection() $this->setCollection($collection); $this->getCollection()->addWebsiteNamesToResult(); + + parent::_prepareCollection(); + return $this; } From 61c995204ec61785da54e9a1ae5ca8040e166f92 Mon Sep 17 00:00:00 2001 From: andimov Date: Thu, 16 Jun 2016 18:54:10 +0300 Subject: [PATCH 15/22] MAGETWO-54226: Tier price information is not saved if count field left empty - config rules for js validation --- .../Product/Form/Modifier/AdvancedPricing.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php index 06c55a765ad3e..fc4204d05943d 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php @@ -480,6 +480,11 @@ protected function getTierPriceStructure($tierPricePath) 'dataType' => Number::NAME, 'label' => __('Quantity'), 'dataScope' => 'price_qty', + 'validation' => [ + 'required-entry' => true, + 'validate-greater-than-zero' => true, + 'validate-number' => true, + ], ], ], ], @@ -497,6 +502,11 @@ protected function getTierPriceStructure($tierPricePath) 'addbefore' => $this->locator->getStore() ->getBaseCurrency() ->getCurrencySymbol(), + 'validation' => [ + 'required-entry' => true, + 'validate-greater-than-zero' => true, + 'validate-number' => true, + ], ], ], ], From fe1a8b213be099d4d50cc27f0a8288329acbe699 Mon Sep 17 00:00:00 2001 From: andimov Date: Thu, 16 Jun 2016 18:54:51 +0300 Subject: [PATCH 16/22] MAGETWO-54226: Tier price information is not saved if count field left empty - remove intval for tier price qty --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/General.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 7b54a508b8168..0720f197a8572 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -105,7 +105,7 @@ protected function customizeAdvancedPriceFormat(array $data) $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE] = $this->formatPrice($value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE]); $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY] = - $this->formatNumber((int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]); + $this->formatNumber($value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]); } } From 6752f7eb4bb2c8f2e5fe164134465be187266453 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Thu, 16 Jun 2016 18:56:40 +0300 Subject: [PATCH 17/22] MAGETWO-52991: [FT] ApplySeveralCatalogPriceRuleEntityTest fails with 2 websites --- .../Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php index ac7823b41eede..4bb5d80b6d672 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php @@ -49,6 +49,10 @@ public function processAssert( $categoryName = $product->getCategoryIds()[0]; $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); $priceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->getPriceBlock(); + \PHPUnit_Framework_Assert::assertTrue( + $priceBlock->isVisible(), + 'Price block is not displayed for product ' . $product->getName() + ); $actualPrice['regular'] = (float)$priceBlock->getOldPrice(); $actualPrice['special'] = (float)$priceBlock->getSpecialPrice(); $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; From f61ba78b3211634f7c47b569f3bab1150691a66f Mon Sep 17 00:00:00 2001 From: andimov Date: Fri, 17 Jun 2016 13:33:07 +0300 Subject: [PATCH 18/22] MAGETWO-54226: Tier price information is not saved if count field left empty - return intval for tier price qty --- .../Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php | 2 +- .../Catalog/Ui/DataProvider/Product/Form/Modifier/General.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php index fc4204d05943d..a618ca4703370 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php @@ -483,7 +483,7 @@ protected function getTierPriceStructure($tierPricePath) 'validation' => [ 'required-entry' => true, 'validate-greater-than-zero' => true, - 'validate-number' => true, + 'validate-digits' => true, ], ], ], diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 0720f197a8572..7b54a508b8168 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -105,7 +105,7 @@ protected function customizeAdvancedPriceFormat(array $data) $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE] = $this->formatPrice($value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE]); $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY] = - $this->formatNumber($value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]); + $this->formatNumber((int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY]); } } From c2bb07358cf4dcad6f6b700883b3a5c01f33a112 Mon Sep 17 00:00:00 2001 From: Roman Ganin Date: Thu, 7 Jul 2016 13:15:09 +0300 Subject: [PATCH 19/22] MAGETWO-53926: [FT] Improve error reporting on Bamboo --- .../Magento/Catalog/Test/Constraint/AssertCategoryPage.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php index 045273dc71f7f..ab016aaa882c3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php @@ -202,12 +202,6 @@ protected function verifyDisplaySettings(array $categoryData) { $errorMessage = []; - if (!$this->categoryViewPage->getTopToolbar()->isVisible()) { - $errorMessage[] = - 'Top toolbar is expected on category page, but not displayed. Skipped verifying display settings.'; - return $errorMessage; - } - //TODO: verify display_mode if (isset($categoryData['default_sort_by'])) { From b774ded200cd2ba562348adb53a398d938fbbece Mon Sep 17 00:00:00 2001 From: Roman Ganin Date: Mon, 11 Jul 2016 16:56:46 +0300 Subject: [PATCH 20/22] MAGETWO-53056: Category tree is not refreshed after changing category URL suffix --- .../Backend/Catalog/Url/Rewrite/Suffix.php | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index a04796c8e2b39..37c867cd6828c 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -94,7 +94,10 @@ public function afterSave() if ($this->isValueChanged()) { $this->updateSuffixForUrlRewrites(); if ($this->isCategorySuffixChanged()) { - $this->invalidateCategoryRelatedCache(); + $this->cacheTypeList->invalidate([ + \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER, + \Magento\Framework\App\Cache\Type\Collection::TYPE_IDENTIFIER + ]); } } return parent::afterSave(); @@ -105,25 +108,12 @@ public function afterSave() * * @return bool */ - protected function isCategorySuffixChanged() + private function isCategorySuffixChanged() { - return $this->isValueChanged() + return $this->isValueChanged() && ($this->getPath() == CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX); } - /** - * Invalidate cache that store old category suffix - * - * @return void - */ - protected function invalidateCategoryRelatedCache() - { - $this->cacheTypeList->invalidate([ - \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER, - \Magento\Framework\App\Cache\Type\Collection::TYPE_IDENTIFIER - ]); - } - /** * Update suffix for url rewrites * From f61025a19269fe47c2fa304f6f93d68586c3496a Mon Sep 17 00:00:00 2001 From: Roman Ganin Date: Mon, 11 Jul 2016 16:58:05 +0300 Subject: [PATCH 21/22] MAGETWO-53056: Category tree is not refreshed after changing category URL suffix --- .../Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index 37c867cd6828c..5ed18d15b2f30 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -110,7 +110,7 @@ public function afterSave() */ private function isCategorySuffixChanged() { - return $this->isValueChanged() + return $this->isValueChanged() && ($this->getPath() == CategoryUrlPathGenerator::XML_PATH_CATEGORY_URL_SUFFIX); } From 239eb86ad436874b5aab37eadba6de0963b4dd11 Mon Sep 17 00:00:00 2001 From: Roman Ganin Date: Tue, 12 Jul 2016 11:45:31 +0300 Subject: [PATCH 22/22] MAGETWO-53056: Category tree is not refreshed after changing category URL suffix --- .../System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php b/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php index 7aa3b9dcd6f9e..7ceb21436b56a 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/System/Config/Backend/Catalog/Url/Rewrite/SuffixTest.php @@ -135,4 +135,4 @@ public function testAfterSaveProduct() $this->cacheTypeList->expects($this->once())->method('invalidate')->with('config'); $this->suffixModel->afterSave(); } -} \ No newline at end of file +}