From 4ac223bb23fce658e1e14b01e3f75bfb44b1e0fb Mon Sep 17 00:00:00 2001 From: "vishalverma.magento279" Date: Wed, 23 Oct 2019 19:02:42 +0530 Subject: [PATCH 01/33] #25192 fixed --- app/code/Magento/Dhl/Model/Carrier.php | 1 + app/code/Magento/Dhl/etc/config.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 5959294fe6dc7..ee2ef84db1f8e 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -675,6 +675,7 @@ public function getDhlProducts($doc) 'H' => __('Economy select'), 'J' => __('Jumbo box'), 'M' => __('Express 10:30'), + 'N' => __('Domestic express'), 'V' => __('Europack'), 'Y' => __('Express 12:00'), ]; diff --git a/app/code/Magento/Dhl/etc/config.xml b/app/code/Magento/Dhl/etc/config.xml index b46152fb0ecad..ea47e4de90f05 100644 --- a/app/code/Magento/Dhl/etc/config.xml +++ b/app/code/Magento/Dhl/etc/config.xml @@ -21,7 +21,7 @@ 0 DHL 0 - 1,3,4,8,P,Q,E,F,H,J,M,V,Y + 1,3,4,8,P,Q,E,F,H,J,M,N,V,Y 2,5,6,7,9,B,C,D,U,K,L,G,W,I,N,O,R,S,T,X G https://xmlpi-ea.dhl.com/XMLShippingServlet From a220df1e08597bd04e97f531e654d11937725796 Mon Sep 17 00:00:00 2001 From: "vishalverma.magento279" Date: Wed, 23 Oct 2019 19:38:49 +0530 Subject: [PATCH 02/33] testcase update --- app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php index d1b35c8e2b77f..e9400e65bc405 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php @@ -332,6 +332,7 @@ public function dhlProductsDataProvider(): array 'H' => 'Economy select', 'J' => 'Jumbo box', 'M' => 'Express 10:30', + 'N' => 'Domestic express', 'V' => 'Europack', 'Y' => 'Express 12:00', ], From f70f1d23c76939e9b1cce5231d178a963d7ae622 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 2 Mar 2020 22:25:05 -0600 Subject: [PATCH 03/33] Explicitly define type for in condition --- .../Model/ResourceModel/Index.php | 4 +-- .../ResourceModel/Selection/Collection.php | 4 +-- .../Model/Resolver/Links/Collection.php | 2 +- .../Indexer/Category/Flat/AbstractAction.php | 9 ++++-- .../Indexer/Category/Flat/Action/Rows.php | 3 +- .../Category/Product/AbstractAction.php | 9 +++--- .../Indexer/Product/Category/Action/Rows.php | 10 +++---- .../Indexer/Product/Flat/FlatTableBuilder.php | 8 ++++-- .../Indexer/Product/Flat/TableBuilder.php | 12 ++++++-- .../Indexer/Product/Price/AbstractAction.php | 4 +-- .../Product/Attribute/AttributeSetFinder.php | 2 +- .../Model/Product/Price/PricePersistence.php | 2 +- .../Product/Price/TierPricePersistence.php | 2 +- .../Model/ResourceModel/AbstractResource.php | 14 ++++++++-- .../Catalog/Model/ResourceModel/Category.php | 7 +++-- .../Model/ResourceModel/Category/Flat.php | 5 ++-- .../Collection/AbstractCollection.php | 12 +++++--- .../Catalog/Model/ResourceModel/Product.php | 8 ++++-- .../ResourceModel/Product/Collection.php | 9 +++--- .../Model/ResourceModel/Product/Gallery.php | 3 +- .../Product/Indexer/Price/DefaultPrice.php | 2 +- .../Product/Indexer/Price/TierPrice.php | 2 +- .../Product/Link/Product/Collection.php | 8 +++--- .../Model/ResourceModel/Product/Website.php | 3 +- .../Model/Indexer/ProductPriceIndexFilter.php | 2 +- .../Model/Indexer/Stock/CacheCleaner.php | 2 +- .../Model/ResourceModel/Stock.php | 6 ++-- .../Model/ResourceModel/Stock/Status.php | 2 +- .../Indexer/ProductPriceIndexModifier.php | 2 +- .../Model/ConfigurableProductsProvider.php | 2 +- .../Indexer/Fulltext/Action/DataProvider.php | 7 +++-- .../Model/Indexer/Fulltext/Action/Full.php | 2 +- .../Model/ResourceModel/Fulltext.php | 3 +- .../Model/ResourceModel/Search/Collection.php | 6 ++-- .../Product/Indexer/Price/Configurable.php | 2 +- .../Product/Type/Configurable.php | 3 +- .../Configurable/Attribute/Collection.php | 3 +- .../Type/Configurable/Product/Collection.php | 2 +- .../Entity/Collection/AbstractCollection.php | 6 ++-- .../Model/ResourceModel/Entity/Attribute.php | 3 +- .../Entity/Attribute/Collection.php | 6 ++-- .../Eav/Model/ResourceModel/ReadHandler.php | 2 +- lib/internal/Magento/Framework/DB/Select.php | 2 +- test.php | 28 +++++++++++++++++++ 44 files changed, 154 insertions(+), 81 deletions(-) create mode 100644 test.php diff --git a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php index b20872da2f8e7..be2e68cf30e1e 100644 --- a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php +++ b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php @@ -108,7 +108,7 @@ protected function _getCatalogProductPriceData($productIds = null) ['entity_id', 'customer_group_id', 'website_id', 'min_price'] ); if ($productIds) { - $select->where('entity_id IN (?)', $productIds); + $select->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE); } $catalogProductIndexPriceSelect[] = $select; } @@ -177,7 +177,7 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null) ); if ($productIds) { - $select->where('product_id IN (?)', $productIds); + $select->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE); } $result = []; diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 7b3f6dd8bbefa..11c83622a3b54 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -215,7 +215,7 @@ public function joinPrices($websiteId) public function setOptionIdsFilter($optionIds) { if (!empty($optionIds)) { - $this->getSelect()->where('selection.option_id IN (?)', $optionIds); + $this->getSelect()->where('selection.option_id IN (?)', $optionIds, \Zend_Db::BIGINT_TYPE); } return $this; } @@ -229,7 +229,7 @@ public function setOptionIdsFilter($optionIds) public function setSelectionIdsFilter($selectionIds) { if (!empty($selectionIds)) { - $this->getSelect()->where('selection.selection_id IN (?)', $selectionIds); + $this->getSelect()->where('selection.selection_id IN (?)', $selectionIds, \Zend_Db::BIGINT_TYPE); } return $this; } diff --git a/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php b/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php index 13bf10bc6aca7..76e670721c31d 100644 --- a/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php +++ b/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php @@ -108,7 +108,7 @@ private function fetch() : array } $linkCollection->getSelect() - ->where($field . ' IN (?)', $this->parentIds); + ->where($field . ' IN (?)', $this->parentIds, \Zend_Db::BIGINT_TYPE); /** @var Selection $link */ foreach ($linkCollection as $link) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index 1506ccf6963bf..50e8df10d57ff 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -414,7 +414,8 @@ private function getLinkIds(array $entityIds) [$linkField] )->where( 'e.entity_id IN (?)', - $entityIds + $entityIds, + \Zend_Db::BIGINT_TYPE ); return $this->connection->fetchCol($select); @@ -459,10 +460,12 @@ protected function getAttributeTypeValues($type, $entityIds, $storeId) ] )->where( "e.entity_id IN (?)", - $entityIds + $entityIds, + \Zend_Db::BIGINT_TYPE )->where( 'def.store_id IN (?)', - [\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId] + [\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId], + \Zend_Db::BIGINT_TYPE ); return $this->connection->fetchAll($select); diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php index c722206193eb3..00499232c8c33 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php @@ -119,7 +119,8 @@ protected function filterIdsByStore(array $ids, $store) "path = {$rootIdExpr} OR path = {$rootCatIdExpr} OR path like {$catIdExpr}" )->where( "entity_id IN (?)", - $ids + $ids, + \Zend_Db::BIGINT_TYPE ); $resultIds = []; diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index 178f4172ce6fa..b0aeea3230d70 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -502,10 +502,11 @@ protected function createAnchorSelect(Store $store) [] )->joinInner( ['cc2' => $temporaryTreeTable], - 'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN (' . implode( - ',', - $rootCatIds - ) . ')', + $this->connection->quoteInto( + 'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN ()', + $rootCatIds, + \Zend_Db::BIGINT_TYPE + ), [] )->joinInner( ['ccp' => $this->getTable('catalog_category_product')], diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php index ec3d0d57330ec..3a9c4a94e58e5 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php @@ -151,7 +151,7 @@ private function getProductIdsWithParents(array $childProductIds): array ->select() ->from(['relation' => $this->getTable('catalog_product_relation')], []) ->distinct(true) - ->where('child_id IN (?)', $childProductIds) + ->where('child_id IN (?)', $childProductIds, \Zend_Db::BIGINT_TYPE) ->join( ['cpe' => $this->getTable('catalog_product_entity')], 'relation.parent_id = cpe.' . $fieldForParent, @@ -215,7 +215,7 @@ protected function removeEntries() protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getNonAnchorCategoriesSelect($store); - return $select->where('ccp.product_id IN (?)', $this->limitationByProducts); + return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE); } /** @@ -227,7 +227,7 @@ protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $stor protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getAnchorCategoriesSelect($store); - return $select->where('ccp.product_id IN (?)', $this->limitationByProducts); + return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE); } /** @@ -239,7 +239,7 @@ protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) protected function getAllProducts(\Magento\Store\Model\Store $store) { $select = parent::getAllProducts($store); - return $select->where('cp.entity_id IN (?)', $this->limitationByProducts); + return $select->where('cp.entity_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE); } /** @@ -265,7 +265,7 @@ private function getCategoryIdsFromIndex(array $productIds): array $storeCategories = $this->connection->fetchCol( $this->connection->select() ->from($this->getIndexTable($store->getId()), ['category_id']) - ->where('product_id IN (?)', $productIds) + ->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) ->distinct() ); $categoryIds[] = $storeCategories; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index 2252b3e3d5506..0d62f780c9aa2 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -340,7 +340,9 @@ protected function _updateTemporaryTableByStoreValues( [$attributeCode => 't.value'] ); if (!empty($changedIds)) { - $select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds)); + $select->where( + $this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + ); } $sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]); $this->_connection->query($sql); @@ -363,7 +365,9 @@ protected function _updateTemporaryTableByStoreValues( [$columnName => $columnValue] )->where($columnValue . ' IS NOT NULL'); if (!empty($changedIds)) { - $select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds)); + $select->where( + $this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE)) + ; } $sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]); $this->_connection->query($sql); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php index c0722901e3b1c..c0632c6c246ce 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php @@ -233,7 +233,9 @@ protected function _fillTemporaryEntityTable($tableName, array $columns, array $ $select->from(['e' => $tableName], $columns); $onDuplicate = false; if (!empty($changedIds)) { - $select->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)); + $select->where( + $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + ); $onDuplicate = true; } $sql = $select->insertFromSelect($temporaryEntityTable, $columns, $onDuplicate); @@ -347,7 +349,9 @@ protected function _fillTemporaryTable( } if (!empty($changedIds)) { - $select->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)); + $select->where( + $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + ); } $sql = $select->insertFromSelect($temporaryTableName, $columns, true); @@ -355,7 +359,9 @@ protected function _fillTemporaryTable( if (count($valueColumns) > 1) { if (!empty($changedIds)) { - $selectValue->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)); + $selectValue->where( + $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + ); } $sql = $selectValue->insertFromSelect($temporaryValueTableName, $valueColumns, true); $this->_connection->query($sql); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php index e9a907f0b5097..1b4d61c899428 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php @@ -410,7 +410,7 @@ private function deleteIndexData(array $entityIds) $select = $this->getConnection()->select()->from( ['index_price' => $this->tableMaintainer->getMainTable($dimensions)], null - )->where('index_price.entity_id IN (?)', $entityIds); + )->where('index_price.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); $query = $select->deleteFromSelect('index_price'); $this->getConnection()->query($query); } @@ -519,7 +519,7 @@ private function getProductsTypes(array $changedIds = []) ['entity_id', 'type_id'] ); if ($changedIds) { - $select->where('entity_id IN (?)', $changedIds); + $select->where('entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE); } $pairs = $this->getConnection()->fetchPairs($select); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php b/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php index 4df67d1c01f16..5211f7470afc2 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php @@ -37,7 +37,7 @@ public function findAttributeSetIdsByProductIds(array $productIds) ->getSelect() ->reset(Select::COLUMNS) ->columns(ProductInterface::ATTRIBUTE_SET_ID) - ->where('entity_id IN (?)', $productIds) + ->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) ->group(ProductInterface::ATTRIBUTE_SET_ID); $result = $collection->getConnection()->fetchCol($select); return $result; diff --git a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php index e3085f7cdefe3..0b8baa56243b3 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php +++ b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php @@ -97,7 +97,7 @@ public function get(array $skus) ->select() ->from($this->attributeResource->getTable($this->table)); return $this->attributeResource->getConnection()->fetchAll( - $select->where($this->getEntityLinkField() . ' IN (?)', $ids) + $select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::BIGINT_TYPE) ->where('attribute_id = ?', $this->getAttributeId()) ); } diff --git a/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php b/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php index fd247d2ce9e32..1088fa7417444 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php +++ b/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php @@ -56,7 +56,7 @@ public function get(array $ids) { $select = $this->tierpriceResource->getConnection()->select()->from($this->tierpriceResource->getMainTable()); return $this->tierpriceResource->getConnection()->fetchAll( - $select->where($this->getEntityLinkField() . ' IN (?)', $ids) + $select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::BIGINT_TYPE) ); } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index 3946be32184ec..cf0e82046f3a5 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -147,7 +147,7 @@ protected function _getLoadAttributesSelect($object, $table) ->select() ->from(['attr_table' => $table], []) ->where("attr_table.{$this->getLinkField()} = ?", $object->getData($this->getLinkField())) - ->where('attr_table.store_id IN (?)', $storeIds); + ->where('attr_table.store_id IN (?)', $storeIds, \Zend_Db::BIGINT_TYPE); if ($setId) { $select->join( @@ -562,7 +562,11 @@ public function getAttributeRawValue($entityId, $attribute, $store) if ($typedAttributes) { foreach ($typedAttributes as $table => $_attributes) { $defaultJoinCondition = [ - $connection->quoteInto('default_value.attribute_id IN (?)', array_keys($_attributes)), + $connection->quoteInto( + 'default_value.attribute_id IN (?)', + array_keys($_attributes), + \Zend_Db::BIGINT_TYPE + ), "default_value.{$this->getLinkField()} = e.{$this->getLinkField()}", 'default_value.store_id = 0', ]; @@ -589,7 +593,11 @@ public function getAttributeRawValue($entityId, $attribute, $store) 'store_value.attribute_id' ); $joinCondition = [ - $connection->quoteInto('store_value.attribute_id IN (?)', array_keys($_attributes)), + $connection->quoteInto( + 'store_value.attribute_id IN (?)', + array_keys($_attributes), + \Zend_Db::BIGINT_TYPE + ), "store_value.{$this->getLinkField()} = e.{$this->getLinkField()}", 'store_value.store_id = :store_id', ]; diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index c4980c917d069..86868a7b28ff6 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -13,13 +13,13 @@ namespace Magento\Catalog\Model\ResourceModel; +use Magento\Catalog\Api\Data\ProductInterface; use Magento\Catalog\Model\Indexer\Category\Product\Processor; +use Magento\Catalog\Setup\CategorySetup; use Magento\Framework\App\ObjectManager; use Magento\Framework\DataObject; use Magento\Framework\EntityManager\EntityManager; -use Magento\Catalog\Setup\CategorySetup; use Magento\Framework\EntityManager\MetadataPool; -use Magento\Catalog\Api\Data\ProductInterface; /** * Resource model for category entity @@ -666,7 +666,8 @@ public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValu 'ci.value = :value' )->where( 'ce.entity_id IN (?)', - $entityIdsFilter + $entityIdsFilter, + \Zend_Db::BIGINT_TYPE ); $this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue] = $this->getConnection()->fetchCol($selectEntities, $bind); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php index 05950531e2178..ffe485a31018f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php @@ -294,7 +294,7 @@ protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId $inactiveCategories = $this->getInactiveCategoryIds(); if (!empty($inactiveCategories)) { - $select->where('main_table.entity_id NOT IN (?)', $inactiveCategories); + $select->where('main_table.entity_id NOT IN (?)', $inactiveCategories, \Zend_Db::BIGINT_TYPE); } // Allow extensions to modify select (e.g. add custom category attributes to select) @@ -681,7 +681,8 @@ public function getAnchorsAbove(array $filterIds, $storeId = 0) 1 )->where( 'entity_id IN (?)', - $filterIds + $filterIds, + \Zend_Db::BIGINT_TYPE ); return $this->getConnection()->fetchCol($select); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php b/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php index 3a0d47fe573fb..490406d7f68f5 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php @@ -170,10 +170,12 @@ protected function _getLoadAttributesSelect($table, $attributeIds = []) ['e.entity_id'] )->where( "e.entity_id IN (?)", - array_keys($this->_itemsById) + array_keys($this->_itemsById), + \Zend_Db::BIGINT_TYPE )->where( 't_d.attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE )->joinLeft( ['t_s' => $table], implode(' AND ', $joinCondition), @@ -192,10 +194,12 @@ protected function _getLoadAttributesSelect($table, $attributeIds = []) ['e.entity_id'] )->where( "e.entity_id IN (?)", - array_keys($this->_itemsById) + array_keys($this->_itemsById), + \Zend_Db::BIGINT_TYPE )->where( 'attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE )->where( 'store_id = ?', $this->getDefaultStoreId() diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product.php b/app/code/Magento/Catalog/Model/ResourceModel/Product.php index c5587d3b25665..747893875d23b 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product.php @@ -232,7 +232,8 @@ public function getWebsiteIdsByProductIds($productIds) ['product_id', 'website_id'] )->where( 'product_id IN (?)', - $productIds + $productIds, + \Zend_Db::BIGINT_TYPE ); $productsWebsites = []; foreach ($this->getConnection()->fetchAll($select) as $productInfo) { @@ -357,7 +358,7 @@ private function deleteSelectedEntityAttributeRows(DataObject $product, array $a $entityId = $product->getData($entityIdField); foreach ($backendTables as $backendTable => $attributes) { $connection = $this->getConnection(); - $where = $connection->quoteInto('attribute_id IN (?)', $attributes); + $where = $connection->quoteInto('attribute_id IN (?)', $attributes, \Zend_Db::BIGINT_TYPE); $where .= $connection->quoteInto(" AND {$entityIdField} = ?", $entityId); $connection->delete($backendTable, $where); } @@ -594,7 +595,8 @@ public function getProductsSku(array $productIds) ['entity_id', 'sku'] )->where( 'entity_id IN (?)', - $productIds + $productIds, + \Zend_Db::BIGINT_TYPE ); return $this->getConnection()->fetchAll($select); } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index afbe279045a38..5f43adc3ab349 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -857,7 +857,8 @@ protected function doAddWebsiteNamesToResult() ['name'] )->where( 'product_website.product_id IN (?)', - array_keys($productWebsites) + array_keys($productWebsites), + \Zend_Db::BIGINT_TYPE )->where( 'website.website_id > ?', 0 @@ -1333,7 +1334,7 @@ public function addCountToCategories($categoryCollection) $anchorStmt = clone $select; $anchorStmt->limit(); //reset limits - $anchorStmt->where('count_table.category_id IN (?)', $isAnchor); + $anchorStmt->where('count_table.category_id IN (?)', $isAnchor, \Zend_Db::BIGINT_TYPE); $productCounts += $this->getConnection()->fetchPairs($anchorStmt); $anchorStmt = null; } @@ -1341,7 +1342,7 @@ public function addCountToCategories($categoryCollection) $notAnchorStmt = clone $select; $notAnchorStmt->limit(); //reset limits - $notAnchorStmt->where('count_table.category_id IN (?)', $isNotAnchor); + $notAnchorStmt->where('count_table.category_id IN (?)', $isNotAnchor, \Zend_Db::BIGINT_TYPE); $notAnchorStmt->where('count_table.is_parent = 1'); $productCounts += $this->getConnection()->fetchPairs($notAnchorStmt); $notAnchorStmt = null; @@ -2151,7 +2152,7 @@ public function addCategoryIds() $select = $this->getConnection()->select(); $select->from($this->_productCategoryTable, ['product_id', 'category_id']); - $select->where('product_id IN (?)', $ids); + $select->where('product_id IN (?)', $ids, \Zend_Db::BIGINT_TYPE); $data = $this->getConnection()->fetchAll($select); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php index a9741cd8e1ec7..b3caeb80b2da7 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php @@ -487,7 +487,8 @@ public function getProductImages($product, $storeIds) $product->getData($this->metadata->getLinkField()) )->where( 'store_id IN (?)', - $storeIds + $storeIds, + \Zend_Db::BIGINT_TYPE )->where( 'attribute_code IN (?)', ['small_image', 'thumbnail', 'image'] diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php index b64cca4ff1b26..fb77a3fad8939 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php @@ -775,7 +775,7 @@ protected function _movePriceDataToIndexTable($entityIds = null) $select = $connection->select()->from($table, $columns); if ($entityIds !== null) { - $select->where('entity_id in (?)', count($entityIds) > 0 ? $entityIds : 0); + $select->where('entity_id in (?)', count($entityIds) > 0 ? $entityIds : 0, \Zend_Db::BIGINT_TYPE); } $query = $select->insertFromSelect($this->getIdxTable(), [], false); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php index a866c1eaa413f..602c2c781443e 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php @@ -193,7 +193,7 @@ private function getTierPriceSelect(bool $isAllWebsites, bool $isAllCustomerGrou [] ); if (!empty($entityIds)) { - $select->where('entity.entity_id IN (?)', $entityIds); + $select->where('entity.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); } $this->joinWebsites($select, $isAllWebsites); $this->joinCustomerGroups($select, $isAllCustomerGroups); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index f1d4552cf37f0..7d702eb76e555 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -239,7 +239,7 @@ public function addExcludeProductFilter($products) $products = [$products]; } $this->_hasLinkFilter = true; - $this->getSelect()->where('links.linked_product_id NOT IN (?)', $products); + $this->getSelect()->where('links.linked_product_id NOT IN (?)', $products, \Zend_Db::BIGINT_TYPE); } return $this; } @@ -257,7 +257,7 @@ public function addProductFilter($products) $products = [$products]; } $identifierField = $this->getLinkField(); - $this->getSelect()->where("product_entity_table.$identifierField IN (?)", $products); + $this->getSelect()->where("product_entity_table.$identifierField IN (?)", $products, \Zend_Db::BIGINT_TYPE); $this->_hasLinkFilter = true; } @@ -319,10 +319,10 @@ protected function _joinLinks() $linkField = $this->getLinkField(); if ($this->productIds) { if ($this->_isStrongMode) { - $this->getSelect()->where('links.product_id in (?)', $this->productIds); + $this->getSelect()->where('links.product_id in (?)', $this->productIds, \Zend_Db::BIGINT_TYPE); } else { $joinType = 'joinLeft'; - $joinCondition[] = $connection->quoteInto('links.product_id in (?)', $this->productIds); + $joinCondition[] = $connection->quoteInto('links.product_id in (?)', $this->productIds, \Zend_Db::BIGINT_TYPE); } if (count($this->productIds) === 1) { $this->addFieldToFilter( diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php index 771f781678e44..dc5efb83c86c7 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php @@ -125,7 +125,8 @@ public function getWebsites($productIds) ['product_id', 'website_id'] )->where( 'product_id IN (?)', - $productIds + $productIds, + \Zend_Db::BIGINT_TYPE ); $rowset = $this->getConnection()->fetchAll($select); diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php b/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php index 35231b8460b19..514cd2e3e88c5 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php @@ -105,7 +105,7 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds = } if (!empty($entityIds)) { - $select->where('stock_item.product_id in (?)', $entityIds); + $select->where('stock_item.product_id in (?)', $entityIds, \Zend_Db::BIGINT_TYPE); } $select->group('stock_item.product_id'); diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php index b3fa07479a712..e38ff58dfe1f6 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php @@ -118,7 +118,7 @@ private function getProductStockStatuses(array $productIds) 'cpr.parent_id = cpe.' . $linkField, ['parent_id' => 'cpe.entity_id'] ) - ->where('product_id IN (?)', $productIds) + ->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) ->where('stock_id = ?', Stock::DEFAULT_STOCK_ID) ->where('website_id = ?', $this->stockConfiguration->getDefaultScopeId()); diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php index 53f00529b9bcc..bb8ff4ce65bba 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php @@ -127,12 +127,12 @@ public function lockProductsStock(array $productIds, $websiteId) $itemTable = $this->getTable('cataloginventory_stock_item'); $select = $this->getConnection()->select()->from(['si' => $itemTable]) ->where('website_id = ?', $websiteId) - ->where('product_id IN(?)', $productIds) + ->where('product_id IN(?)', $productIds, \Zend_Db::BIGINT_TYPE) ->forUpdate(true); $productTable = $this->getTable('catalog_product_entity'); $selectProducts = $this->getConnection()->select()->from(['p' => $productTable], []) - ->where('entity_id IN (?)', $productIds) + ->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) ->columns( [ 'product_id' => 'entity_id', @@ -147,7 +147,7 @@ public function lockProductsStock(array $productIds, $websiteId) foreach ($this->getConnection()->fetchAll($selectProducts) as $p) { $items[$p['product_id']]['type_id'] = $p['type_id']; } - + return $items; } diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php index 402ce5f2f611e..6ffa6f4a1169b 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php @@ -321,7 +321,7 @@ public function getProductStatus($productIds, $storeId = null) if ($storeId === null || $storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { $select = $connection->select()->from($attributeTable, [$linkField, 'value']) - ->where("{$linkField} IN (?)", $productIds) + ->where("{$linkField} IN (?)", $productIds, \Zend_Db::BIGINT_TYPE) ->where('attribute_id = ?', $attribute->getAttributeId()) ->where('store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); diff --git a/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php b/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php index 404fc32e0c0d4..7f64573587ca0 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php @@ -71,7 +71,7 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds = [] ); if ($entityIds) { - $select->where('i.entity_id IN (?)', $entityIds); + $select->where('i.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); } $finalPrice = $priceTable->getFinalPriceField(); diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php index dd020114b03ab..d6e8033987ee8 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php +++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php @@ -40,7 +40,7 @@ public function getIds(array $ids) ->select() ->from(['e' => $this->resource->getTableName('catalog_product_entity')], ['e.entity_id']) ->where('e.type_id = ?', \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) - ->where('e.entity_id IN (?)', $ids) + ->where('e.entity_id IN (?)', $ids, \Zend_Db::BIGINT_TYPE) ); } return $this->productIds[$key]; diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php index cd2529a8fd725..9ec48cfa05694 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php @@ -242,7 +242,7 @@ private function getSelectForSearchableProducts( $this->joinAttribute($select, 'status', $storeId, [Status::STATUS_ENABLED]); if ($productIds !== null) { - $select->where('e.entity_id IN (?)', $productIds); + $select->where('e.entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE); } $select->where('e.entity_id > ?', $lastProductId); $select->order('e.entity_id'); @@ -323,7 +323,7 @@ public function getSearchableAttributes($backendType = null) 'catelogsearch_searchable_attributes_load_after', ['engine' => $this->engine, 'attributes' => $attributes] ); - + $this->eventManager->dispatch( 'catalogsearch_searchable_attributes_load_after', ['engine' => $this->engine, 'attributes' => $attributes] @@ -410,7 +410,8 @@ public function getProductAttributes($storeId, array $productIds, array $attribu [$linkField, 'entity_id'] )->where( 'cpe.entity_id IN (?)', - $productIds + $productIds, + \Zend_Db::BIGINT_TYPE ) ); foreach ($attributeTypes as $backendType => $attributeIds) { diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php index f56a4fe4d1b76..55b9649f26614 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php @@ -324,7 +324,7 @@ protected function getProductIdsFromParents(array $entityIds) ->select() ->from(['relation' => $this->getTable('catalog_product_relation')], []) ->distinct(true) - ->where('child_id IN (?)', $entityIds) + ->where('child_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE) ->join( ['cpe' => $this->getTable('catalog_product_entity')], 'relation.parent_id = cpe.' . $linkField, diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php index 0835fb66f876a..da95e9cf3603b 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php @@ -115,7 +115,8 @@ public function getRelationsByChild($childIds) ['cpe.entity_id'] )->where( 'relation.child_id IN (?)', - $childIds + $childIds, + \Zend_Db::BIGINT_TYPE ); return $connection->fetchCol($select); diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php index e625ccbe51fe3..df4f834006e80 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php @@ -258,7 +258,8 @@ protected function _getSearchEntityIdsSql($query, $searchOnlyInCurrentStore = tr [] )->where( 't1.attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE )->where( 't1.store_id = ?', 0 @@ -332,7 +333,8 @@ protected function _getSearchInOptionSql($query) 'd.store_id=0' )->where( 'o.attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE )->where( $this->_resourceHelper->getCILike($ifValue, $this->_searchQuery, ['position' => 'any']) ); diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index b7bbf7aa1871c..b60ea1d07b85a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -222,7 +222,7 @@ private function fillTemporaryOptionsTable(string $temporaryOptionsTableName, ar ['le.entity_id', 'customer_group_id', 'website_id'] ); if ($entityIds !== null) { - $select->where('le.entity_id IN (?)', $entityIds); + $select->where('le.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); } $query = $select->insertFromSelect($temporaryOptionsTableName); $this->getConnection()->query($query); diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php index feffd22a0fb3d..0abfd953e3435 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php @@ -173,7 +173,8 @@ public function getChildrenIds($parentId, $required = true) [] )->where( 'p.entity_id IN (?)', - $parentId + $parentId, + \Zend_Db::BIGINT_TYPE ); $childrenIds = [ diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php index 57f701721a6f3..61ebdc5531b6a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php @@ -285,7 +285,8 @@ protected function _loadLabels() ['use_default' => $useDefaultCheck, 'label' => $labelCheck] )->where( 'def.product_super_attribute_id IN (?)', - array_keys($this->_items) + array_keys($this->_items), + \Zend_Db::BIGINT_TYPE )->where( 'def.store_id = ?', 0 diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php index b76954075bcde..d25423dd6e9d2 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php @@ -84,7 +84,7 @@ protected function _renderFilters() $parentIds[] = $product->getData($metadata->getLinkField()); } - $this->getSelect()->where('link_table.parent_id in (?)', $parentIds); + $this->getSelect()->where('link_table.parent_id in (?)', $parentIds,\Zend_Db::BIGINT_TYPE); return $this; } diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index e50abbc11e54a..8cf21f6108d93 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -1238,10 +1238,12 @@ protected function _getLoadAttributesSelect($table, $attributeIds = []) ['t_d.attribute_id'] )->where( " e.entity_id IN (?)", - array_keys($this->_itemsById) + array_keys($this->_itemsById), + \Zend_Db::BIGINT_TYPE )->where( 't_d.attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE ); if ($entity->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE && $entity->getTypeId()) { diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php index 9e4ad6fb53a33..84e3092879f5c 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php @@ -769,7 +769,8 @@ public function getValidAttributeIds($attributeIds) ['attribute_id'] )->where( 'attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE ); return $connection->fetchCol($select); diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php index 6fce6bd2dc44e..e54f888b0ffab 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php @@ -221,7 +221,8 @@ public function setInAllAttributeSetsFilter(array $setIds) ) ->where( 'entity_attribute.attribute_set_id IN (?)', - $setIds + $setIds, + \Zend_Db::BIGINT_TYPE ) ->group('entity_attribute.attribute_id') ->having(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds)); @@ -394,7 +395,8 @@ protected function _addSetInfo() ['group_sort_order' => 'sort_order'] )->where( 'attribute_id IN (?)', - $attributeIds + $attributeIds, + \Zend_Db::BIGINT_TYPE ); $result = $connection->fetchAll($select); diff --git a/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php b/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php index bf1405fa64122..54eb815fd10a6 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php +++ b/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php @@ -152,7 +152,7 @@ public function execute($entityType, $entityData, $arguments = []) ['value' => 't.value', 'attribute_id' => 't.attribute_id'] ) ->where($metadata->getLinkField() . ' = ?', $entityData[$metadata->getLinkField()]) - ->where('attribute_id IN (?)', $attributeIds); + ->where('attribute_id IN (?)', $attributeIds, \Zend_Db::BIGINT_TYPE); $attributeIdentifiers = []; foreach ($context as $scope) { //TODO: if (in table exists context field) diff --git a/lib/internal/Magento/Framework/DB/Select.php b/lib/internal/Magento/Framework/DB/Select.php index ceeed40787123..f7ffece8fa3c0 100644 --- a/lib/internal/Magento/Framework/DB/Select.php +++ b/lib/internal/Magento/Framework/DB/Select.php @@ -113,7 +113,7 @@ public function where($cond, $value = null, $type = null) $type = null; } if (is_array($value)) { - $cond = $this->getConnection()->quoteInto($cond, $value); + $cond = $this->getConnection()->quoteInto($cond, $value, $type); $value = null; } return parent::where($cond, $value, $type); diff --git a/test.php b/test.php new file mode 100644 index 0000000000000..cb6a19e52b4ec --- /dev/null +++ b/test.php @@ -0,0 +1,28 @@ +getObjectManager(); + +$state = $om->get('Magento\Framework\App\State'); +$state->setAreaCode('frontend'); +$pc = $om->get(\Magento\Catalog\Model\ResourceModel\Product\Collection::class) + ->setPageSize(10) + ->load(); +var_dump($pc); + +// +///** @var \Magento\Eav\Model\Cache\Type $cache */ +//$cache = $om->get(\Magento\Eav\Model\Cache\Type::class); +//$i = 0; +//$d = 0; +//while (true) { +// echo '-\\|/'[$i % 4], "\r"; +// $key = "my_test_data" . $i++; +// $cache->save('data',$key , ['tag1', 'tag2' ], 1000); +// if ( 'data' !== $cache->load($key)) { +// $d ++; +// echo ' : Missread is - ' . number_format($d/$i, 2) , "\r"; +// } +//} \ No newline at end of file From 27e1c6ee41698a5b624fdb937018bde53a248705 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 2 Mar 2020 22:41:52 -0600 Subject: [PATCH 04/33] Explicitly define type for in condition --- .../Catalog/Model/Indexer/Category/Product/Action/Full.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php index eee347c36910d..71bbc45d77532 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php @@ -282,7 +282,7 @@ private function reindexCategoriesBySelect(Select $basicSelect, $whereCondition, $this->connection->delete($this->tableMaintainer->getMainTmpTable((int)$store->getId())); $entityIds = $this->connection->fetchCol($query); $resultSelect = clone $basicSelect; - $resultSelect->where($whereCondition, $entityIds); + $resultSelect->where($whereCondition, $entityIds, \Zend_Db::BIGINT_TYPE); $this->connection->query( $this->connection->insertFromSelect( $resultSelect, From 4a22091f79ec0c551f2863f9053ed952b6cf6fcf Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 2 Mar 2020 22:47:36 -0600 Subject: [PATCH 05/33] Explicitly define type for in condition --- .../Catalog/Model/Indexer/Category/Product/AbstractAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index b0aeea3230d70..b9433fda47235 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -503,7 +503,7 @@ protected function createAnchorSelect(Store $store) )->joinInner( ['cc2' => $temporaryTreeTable], $this->connection->quoteInto( - 'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN ()', + 'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN (?)', $rootCatIds, \Zend_Db::BIGINT_TYPE ), From a36c9a988c4fca9f9b525477976192000d3ce605 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 2 Mar 2020 22:53:10 -0600 Subject: [PATCH 06/33] Explicitly define type for in condition --- test.php | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 test.php diff --git a/test.php b/test.php deleted file mode 100644 index cb6a19e52b4ec..0000000000000 --- a/test.php +++ /dev/null @@ -1,28 +0,0 @@ -getObjectManager(); - -$state = $om->get('Magento\Framework\App\State'); -$state->setAreaCode('frontend'); -$pc = $om->get(\Magento\Catalog\Model\ResourceModel\Product\Collection::class) - ->setPageSize(10) - ->load(); -var_dump($pc); - -// -///** @var \Magento\Eav\Model\Cache\Type $cache */ -//$cache = $om->get(\Magento\Eav\Model\Cache\Type::class); -//$i = 0; -//$d = 0; -//while (true) { -// echo '-\\|/'[$i % 4], "\r"; -// $key = "my_test_data" . $i++; -// $cache->save('data',$key , ['tag1', 'tag2' ], 1000); -// if ( 'data' !== $cache->load($key)) { -// $d ++; -// echo ' : Missread is - ' . number_format($d/$i, 2) , "\r"; -// } -//} \ No newline at end of file From 1515252083346dc1db63961c22c35aff79b93ea3 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 9 Mar 2020 22:54:24 -0500 Subject: [PATCH 07/33] Update app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php Co-Authored-By: Ihor Sviziev --- .../Product/Type/Configurable/Product/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php index d25423dd6e9d2..c8e761fb5ed22 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php @@ -84,7 +84,7 @@ protected function _renderFilters() $parentIds[] = $product->getData($metadata->getLinkField()); } - $this->getSelect()->where('link_table.parent_id in (?)', $parentIds,\Zend_Db::BIGINT_TYPE); + $this->getSelect()->where('link_table.parent_id in (?)', $parentIds, \Zend_Db::BIGINT_TYPE); return $this; } From de530f7be37c64617225ed428c269e34875bda23 Mon Sep 17 00:00:00 2001 From: Baljinder Hayre Date: Thu, 12 Mar 2020 16:33:48 +0000 Subject: [PATCH 08/33] #26288 Will now throw an exception when a customer does not exist who wants to reset password --- .../Customer/Model/ForgotPasswordToken/GetCustomerByToken.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php b/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php index 09af4e296bd92..368770766f45a 100644 --- a/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php +++ b/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php @@ -73,7 +73,7 @@ public function execute(string $resetPasswordToken):CustomerInterface } if ($found->getTotalCount() === 0) { //Customer with such token not found. - new NoSuchEntityException( + throw new NoSuchEntityException( new Phrase( 'No such entity with rp_token = %value', [ From f44add27fbdd5e41023dc7994d13962d84eba69b Mon Sep 17 00:00:00 2001 From: Baljinder Hayre Date: Thu, 12 Mar 2020 16:33:48 +0000 Subject: [PATCH 09/33] #26288 Throw an exception when a customer does not exist requests password reset --- .../Customer/Model/ForgotPasswordToken/GetCustomerByToken.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php b/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php index 09af4e296bd92..211a71d827f7e 100644 --- a/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php +++ b/app/code/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByToken.php @@ -73,7 +73,7 @@ public function execute(string $resetPasswordToken):CustomerInterface } if ($found->getTotalCount() === 0) { //Customer with such token not found. - new NoSuchEntityException( + throw new NoSuchEntityException( new Phrase( 'No such entity with rp_token = %value', [ From 5d11fdc55dd2d6563a97896042ebbaa459b9ffef Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Thu, 7 May 2020 14:57:13 +0300 Subject: [PATCH 10/33] Cover Unit test --- .../GetCustomerByTokenTest.php | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php diff --git a/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php b/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php new file mode 100644 index 0000000000000..219058eebf8f8 --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php @@ -0,0 +1,145 @@ +searchCriteriaBuilderMock = $this->createMock(SearchCriteriaBuilder::class); + $this->searchCriteriaMock = $this->createMock(SearchCriteria::class); + $this->searchResultMock = $this->createMock(CustomerSearchResultsInterface::class); + $this->customerRepositoryMock = $this->createMock(CustomerRepositoryInterface::class); + $this->customerMock = $this->getMockForAbstractClass(CustomerInterface::class); + + $objectManagerHelper = new ObjectManagerHelper($this); + $this->model = $objectManagerHelper->getObject( + GetCustomerByToken::class, + [ + 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock, + 'customerRepository' => $this->customerRepositoryMock + ] + ); + + $this->searchCriteriaBuilderMock->expects($this->once()) + ->method('create') + ->willReturn($this->searchCriteriaMock); + $this->customerRepositoryMock->expects($this->once()) + ->method('getList') + ->with($this->searchCriteriaMock) + ->willReturn($this->searchResultMock); + } + + /** + * @return void + */ + public function testExecute(): void + { + $totalCount = 1; + $this->searchResultMock->expects($this->any()) + ->method('getTotalCount') + ->willReturn($totalCount); + $this->searchResultMock->expects($this->once()) + ->method('getItems') + ->willReturn([$this->customerMock]); + + $this->assertInstanceOf( + CustomerInterface::class, + $this->model->execute(self::RESET_PASSWORD) + ); + } + + /** + * @return void + */ + public function testExecuteWithNoSuchEntityException(): void + { + $totalCount = 0; + $this->searchResultMock->expects($this->any()) + ->method('getTotalCount') + ->willReturn($totalCount); + $this->expectExceptionObject(new NoSuchEntityException( + new Phrase( + 'No such entity with rp_token = %value', + ['value' => self::RESET_PASSWORD] + ) + )); + + $this->model->execute(self::RESET_PASSWORD); + } + + /** + * @return void + */ + public function testExecuteWithExpireException(): void + { + $totalCount = 2; + $this->searchResultMock->expects($this->any()) + ->method('getTotalCount') + ->willReturn($totalCount); + + $this->expectExceptionObject(new ExpiredException( + new Phrase( + 'Reset password token expired.' + ) + )); + + $this->model->execute(self::RESET_PASSWORD); + } +} From d30e5e211962dd7b0d25bb6c289736ea128ecf0d Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Thu, 7 May 2020 16:14:40 +0300 Subject: [PATCH 11/33] refactor unit test --- .../GetCustomerByTokenTest.php | 45 +++++-------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php b/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php index 219058eebf8f8..0de1912ee4f7e 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php @@ -20,47 +20,41 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -/** - * Test GetCustomerByToken class - */ class GetCustomerByTokenTest extends TestCase { - protected const RESET_PASSWORD = 'resetPassword'; + private const RESET_PASSWORD = 'resetPassword'; /** * @var SearchCriteriaBuilder|MockObject */ - protected $searchCriteriaBuilderMock; + private $searchCriteriaBuilderMock; /** * @var SearchCriteria|MockObject */ - protected $searchCriteriaMock; + private $searchCriteriaMock; /** * @var CustomerRepositoryInterface|MockObject */ - protected $customerRepositoryMock; + private $customerRepositoryMock; /** * @var CustomerSearchResultsInterface|MockObject */ - protected $searchResultMock; + private $searchResultMock; /** * @var CustomerInterface|MockObject */ - protected $customerMock; + private $customerMock; /** * @var GetCustomerByToken; */ - protected $model; + private $model; - /** - * @inheritDoc - */ - public function setUp() + protected function setUp() { $this->searchCriteriaBuilderMock = $this->createMock(SearchCriteriaBuilder::class); $this->searchCriteriaMock = $this->createMock(SearchCriteria::class); @@ -86,15 +80,10 @@ public function setUp() ->willReturn($this->searchResultMock); } - /** - * @return void - */ - public function testExecute(): void + public function testExecuteReturnWhenOneItemAvailable(): void { $totalCount = 1; - $this->searchResultMock->expects($this->any()) - ->method('getTotalCount') - ->willReturn($totalCount); + $this->searchResultMock->method('getTotalCount')->willReturn($totalCount); $this->searchResultMock->expects($this->once()) ->method('getItems') ->willReturn([$this->customerMock]); @@ -105,15 +94,10 @@ public function testExecute(): void ); } - /** - * @return void - */ public function testExecuteWithNoSuchEntityException(): void { $totalCount = 0; - $this->searchResultMock->expects($this->any()) - ->method('getTotalCount') - ->willReturn($totalCount); + $this->searchResultMock->method('getTotalCount')->willReturn($totalCount); $this->expectExceptionObject(new NoSuchEntityException( new Phrase( 'No such entity with rp_token = %value', @@ -124,15 +108,10 @@ public function testExecuteWithNoSuchEntityException(): void $this->model->execute(self::RESET_PASSWORD); } - /** - * @return void - */ public function testExecuteWithExpireException(): void { $totalCount = 2; - $this->searchResultMock->expects($this->any()) - ->method('getTotalCount') - ->willReturn($totalCount); + $this->searchResultMock->method('getTotalCount')->willReturn($totalCount); $this->expectExceptionObject(new ExpiredException( new Phrase( From 000c822b5f027db3bb8ba83414b1f6ffd7664269 Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Fri, 8 May 2020 12:20:12 +0300 Subject: [PATCH 12/33] add integration test --- .../GetCustomerByTokenTest.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php new file mode 100644 index 0000000000000..10a30f10e96a7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php @@ -0,0 +1,41 @@ +objectManager = Bootstrap::getObjectManager(); + $this->customerByToken = $this->objectManager->get(GetCustomerByToken::class); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testExecuteWithNoSuchEntityException(): void + { + $this->expectExceptionMessage('No such entity with rp_token = ' . self::RESET_PASSWORD); + $this->customerByToken->execute(self::RESET_PASSWORD); + } +} From e099ad1956bf9274000335da43a7f31a27d3d982 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 10 May 2020 19:51:27 -0500 Subject: [PATCH 13/33] Improve code quality --- .../Model/ResourceModel/Index.php | 20 +-- .../Indexer/Category/Flat/AbstractAction.php | 82 +++++++----- .../Indexer/Category/Flat/Action/Rows.php | 34 ++--- .../Category/Product/AbstractAction.php | 2 +- .../Indexer/Category/Product/Action/Full.php | 2 +- .../Indexer/Product/Flat/FlatTableBuilder.php | 61 +++++---- .../Indexer/Product/Flat/Table/Builder.php | 2 +- .../Indexer/Product/Price/AbstractAction.php | 126 ++++++++++-------- .../Product/Attribute/AttributeSetFinder.php | 2 +- .../Model/Product/Price/PricePersistence.php | 48 ++++--- .../Catalog/Model/ResourceModel/Category.php | 1 - .../Product/Link/Product/Collection.php | 114 +++++++++------- .../Model/ResourceModel/Stock/Status.php | 60 ++++++--- .../Model/ConfigurableProductsProvider.php | 4 +- .../Type/Configurable/Product/Collection.php | 2 +- .../Entity/Attribute/Collection.php | 58 ++++---- 16 files changed, 365 insertions(+), 253 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php index be2e68cf30e1e..bf6a62f36e440 100644 --- a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php +++ b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php @@ -5,18 +5,19 @@ */ namespace Magento\AdvancedSearch\Model\ResourceModel; -use Magento\Framework\Model\ResourceModel\Db\AbstractDb; -use Magento\Framework\Search\Request\IndexScopeResolverInterface; -use Magento\Store\Model\StoreManagerInterface; -use Magento\Framework\Model\ResourceModel\Db\Context; -use Magento\Framework\EntityManager\MetadataPool; use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction; +use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; use Magento\Framework\App\ObjectManager; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Framework\Search\Request\Dimension; -use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction; +use Magento\Framework\Search\Request\IndexScopeResolverInterface; use Magento\Framework\Search\Request\IndexScopeResolverInterface as TableResolver; -use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; use Magento\Store\Model\Indexer\WebsiteDimensionProvider; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; /** * @api @@ -55,6 +56,7 @@ class Index extends AbstractDb /** * Index constructor. + * * @param Context $context * @param StoreManagerInterface $storeManager * @param MetadataPool $metadataPool @@ -80,7 +82,9 @@ public function __construct( /** * Implementation of abstract construct + * * @return void + * @SuppressWarnings(PHPMD) * @since 100.1.0 */ protected function _construct() @@ -159,7 +163,7 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null) { $connection = $this->getConnection(); - $catalogCategoryProductDimension = new Dimension(\Magento\Store\Model\Store::ENTITY, $storeId); + $catalogCategoryProductDimension = new Dimension(Store::ENTITY, $storeId); $catalogCategoryProductTableName = $this->tableResolver->resolve( AbstractAction::MAIN_INDEX_TABLE, diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index 50e8df10d57ff..f2148a721d764 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -6,10 +6,21 @@ namespace Magento\Catalog\Model\Indexer\Category\Flat; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\ResourceModel\Helper; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\DB\Ddl\Table; +use Magento\Framework\EntityManager\EntityMetadata; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; /** * Abstract action class for category flat indexers. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AbstractAction { @@ -31,14 +42,14 @@ class AbstractAction protected $resource; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $storeManager; /** * Catalog resource helper * - * @var \Magento\Catalog\Model\ResourceModel\Helper + * @var Helper */ protected $resourceHelper; @@ -50,12 +61,12 @@ class AbstractAction protected $columns = []; /** - * @var \Magento\Framework\DB\Adapter\AdapterInterface + * @var AdapterInterface */ protected $connection; /** - * @var \Magento\Framework\EntityManager\EntityMetadata + * @var EntityMetadata */ protected $categoryMetadata; @@ -68,13 +79,13 @@ class AbstractAction /** * @param ResourceConnection $resource - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper + * @param StoreManagerInterface $storeManager + * @param Helper $resourceHelper */ public function __construct( ResourceConnection $resource, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper + StoreManagerInterface $storeManager, + Helper $resourceHelper ) { $this->resource = $resource; $this->connection = $resource->getConnection(); @@ -110,23 +121,22 @@ public function getColumns() * @param integer $storeId * @return string */ - public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID) + public function getMainStoreTable($storeId = Store::DEFAULT_STORE_ID) { if (is_string($storeId)) { $storeId = (int) $storeId; } $suffix = sprintf('store_%d', $storeId); - $table = $this->connection->getTableName($this->getTableName('catalog_category_flat_' . $suffix)); - - return $table; + return $this->connection->getTableName($this->getTableName('catalog_category_flat_' . $suffix)); } /** * Return structure for flat catalog table * * @param string $tableName - * @return \Magento\Framework\DB\Ddl\Table + * @return Table + * @throws \Zend_Db_Exception */ protected function getFlatTableStructure($tableName) { @@ -139,10 +149,10 @@ protected function getFlatTableStructure($tableName) //Adding columns foreach ($this->getColumns() as $fieldName => $fieldProp) { $default = $fieldProp['default']; - if ($fieldProp['type'][0] == \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP + if ($fieldProp['type'][0] == Table::TYPE_TIMESTAMP && $default == 'CURRENT_TIMESTAMP' ) { - $default = \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT; + $default = Table::TIMESTAMP_INIT; } $table->addColumn( $fieldName, @@ -205,9 +215,9 @@ protected function getStaticColumns() $ddlType = $this->resourceHelper->getDdlTypeByColumnType($column['DATA_TYPE']); $column['DEFAULT'] = trim($column['DEFAULT'], "' "); switch ($ddlType) { - case \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT: - case \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER: - case \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT: + case Table::TYPE_SMALLINT: + case Table::TYPE_INTEGER: + case Table::TYPE_BIGINT: $isUnsigned = (bool)$column['UNSIGNED']; if ($column['DEFAULT'] === '') { $column['DEFAULT'] = null; @@ -215,27 +225,27 @@ protected function getStaticColumns() $options = null; if ($column['SCALE'] > 0) { - $ddlType = \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL; + $ddlType = Table::TYPE_DECIMAL; } else { break; } // fall-through intentional - case \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL: + case Table::TYPE_DECIMAL: $options = $column['PRECISION'] . ',' . $column['SCALE']; $isUnsigned = null; if ($column['DEFAULT'] === '') { $column['DEFAULT'] = null; } break; - case \Magento\Framework\DB\Ddl\Table::TYPE_TEXT: + case Table::TYPE_TEXT: $options = $column['LENGTH']; $isUnsigned = null; break; - case \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP: + case Table::TYPE_TIMESTAMP: $options = null; $isUnsigned = null; break; - case \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME: + case Table::TYPE_DATETIME: $isUnsigned = null; break; } @@ -248,7 +258,7 @@ protected function getStaticColumns() ]; } $columns['store_id'] = [ - 'type' => [\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 5], + 'type' => [Table::TYPE_SMALLINT, 5], 'unsigned' => true, 'nullable' => false, 'default' => '0', @@ -274,7 +284,7 @@ protected function getEavColumns() switch ($attribute['backend_type']) { case 'varchar': $columns[$attribute['attribute_code']] = [ - 'type' => [\Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255], + 'type' => [Table::TYPE_TEXT, 255], 'unsigned' => null, 'nullable' => true, 'default' => null, @@ -283,7 +293,7 @@ protected function getEavColumns() break; case 'int': $columns[$attribute['attribute_code']] = [ - 'type' => [\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null], + 'type' => [Table::TYPE_INTEGER, null], 'unsigned' => null, 'nullable' => true, 'default' => null, @@ -292,7 +302,7 @@ protected function getEavColumns() break; case 'text': $columns[$attribute['attribute_code']] = [ - 'type' => [\Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k'], + 'type' => [Table::TYPE_TEXT, '64k'], 'unsigned' => null, 'nullable' => true, 'default' => null, @@ -301,7 +311,7 @@ protected function getEavColumns() break; case 'datetime': $columns[$attribute['attribute_code']] = [ - 'type' => [\Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, null], + 'type' => [Table::TYPE_DATETIME, null], 'unsigned' => null, 'nullable' => true, 'default' => null, @@ -310,7 +320,7 @@ protected function getEavColumns() break; case 'decimal': $columns[$attribute['attribute_code']] = [ - 'type' => [\Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4'], + 'type' => [Table::TYPE_DECIMAL, '12,4'], 'unsigned' => null, 'nullable' => true, 'default' => null, @@ -346,7 +356,7 @@ protected function getAttributes() $this->connection->getTableName( $this->getTableName('eav_entity_type') ) . '.entity_type_code = ?', - \Magento\Catalog\Model\Category::ENTITY + Category::ENTITY ); $this->attributeCodes = []; foreach ($this->connection->fetchAll($select) as $attribute) { @@ -464,7 +474,7 @@ protected function getAttributeTypeValues($type, $entityIds, $storeId) \Zend_Db::BIGINT_TYPE )->where( 'def.store_id IN (?)', - [\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId], + [Store::DEFAULT_STORE_ID, $storeId], \Zend_Db::BIGINT_TYPE ); @@ -504,14 +514,14 @@ protected function getTableName($name) /** * Get category metadata instance. * - * @return \Magento\Framework\EntityManager\EntityMetadata + * @return EntityMetadata */ private function getCategoryMetadata() { if (null === $this->categoryMetadata) { - $metadataPool = \Magento\Framework\App\ObjectManager::getInstance() + $metadataPool = ObjectManager::getInstance() ->get(\Magento\Framework\EntityManager\MetadataPool::class); - $this->categoryMetadata = $metadataPool->getMetadata(\Magento\Catalog\Api\Data\CategoryInterface::class); + $this->categoryMetadata = $metadataPool->getMetadata(CategoryInterface::class); } return $this->categoryMetadata; } @@ -524,8 +534,8 @@ private function getCategoryMetadata() private function getSkipStaticColumns() { if (null === $this->skipStaticColumns) { - $provider = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Catalog\Model\Indexer\Category\Flat\SkipStaticColumnsProvider::class); + $provider = ObjectManager::getInstance() + ->get(SkipStaticColumnsProvider::class); $this->skipStaticColumns = $provider->get(); } return $this->skipStaticColumns; diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php index 00499232c8c33..c5751d580607b 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php @@ -171,27 +171,30 @@ private function buildIndexData(Store $store, $categoriesIdsChunk, $attributesDa foreach ($categoriesIdsChunk as $categoryId) { try { $category = $this->categoryRepository->get($categoryId); - $categoryData = $category->getData(); - $linkId = $categoryData[$linkField]; - - $categoryAttributesData = []; - if (isset($attributesData[$linkId]) && is_array($attributesData[$linkId])) { - $categoryAttributesData = $attributesData[$linkId]; - } - $categoryIndexData = $this->buildCategoryIndexData( - $store, - $categoryData, - $categoryAttributesData - ); - $data[] = $categoryIndexData; } catch (NoSuchEntityException $e) { - // ignore + continue; } + + $categoryData = $category->getData(); + $linkId = $categoryData[$linkField]; + + $categoryAttributesData = []; + if (isset($attributesData[$linkId]) && is_array($attributesData[$linkId])) { + $categoryAttributesData = $attributesData[$linkId]; + } + $categoryIndexData = $this->buildCategoryIndexData( + $store, + $categoryData, + $categoryAttributesData + ); + $data[] = $categoryIndexData; } return $data; } /** + * Prepare Category data + * * @param Store $store * @param array $categoryData * @param array $categoryAttributesData @@ -214,7 +217,8 @@ private function buildCategoryIndexData(Store $store, array $categoryData, array * Insert or update index data * * @param string $tableName - * @param $data + * @param array $data + * @return void */ private function updateIndexData($tableName, $data) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index b9433fda47235..42e9e4309a08b 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -42,7 +42,7 @@ abstract class AbstractAction /** * Suffix for table to show it is temporary - * @deprecated + * @deprecated see getIndexTable */ const TEMPORARY_TABLE_SUFFIX = '_tmp'; diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php index 71bbc45d77532..f758fd1759309 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php @@ -174,7 +174,7 @@ protected function reindex(): void foreach ($this->storeManager->getStores() as $store) { if ($this->getPathFromCategoryId($store->getRootCategoryId())) { $userFunctions[$store->getId()] = function () use ($store) { - return $this->reindexStore($store); + $this->reindexStore($store); }; } } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index 0d62f780c9aa2..e92778226aadd 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -6,8 +6,18 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Helper\Product\Flat\Indexer; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Eav\Model\Entity\Attribute; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\DB\Ddl\Table; +use Magento\Framework\DB\Select; use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\Exception\LocalizedException; +use Magento\Store\Model\StoreManagerInterface; /** * Class for building flat index @@ -27,22 +37,22 @@ class FlatTableBuilder const XML_NODE_MAX_INDEX_COUNT = 'catalog/product/flat/max_index_count'; /** - * @var \Magento\Catalog\Helper\Product\Flat\Indexer + * @var Indexer */ protected $_productIndexerHelper; /** - * @var \Magento\Framework\DB\Adapter\AdapterInterface + * @var AdapterInterface */ protected $_connection; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface $config + * @var ScopeConfigInterface $config */ protected $_config; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; @@ -52,23 +62,23 @@ class FlatTableBuilder protected $_tableData; /** - * @var \Magento\Framework\App\ResourceConnection + * @var ResourceConnection */ protected $resource; /** - * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper + * @param Indexer $productIndexerHelper * @param ResourceConnection $resource - * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param ScopeConfigInterface $config + * @param StoreManagerInterface $storeManager * @param TableDataInterface $tableData */ public function __construct( - \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper, - \Magento\Framework\App\ResourceConnection $resource, - \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData + Indexer $productIndexerHelper, + ResourceConnection $resource, + ScopeConfigInterface $config, + StoreManagerInterface $storeManager, + TableDataInterface $tableData ) { $this->_productIndexerHelper = $productIndexerHelper; $this->resource = $resource; @@ -114,7 +124,8 @@ public function build($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix * * @param int|string $storeId * @return void - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException + * @throws \Zend_Db_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -128,7 +139,7 @@ protected function _createTemporaryFlatTable($storeId) self::XML_NODE_MAX_INDEX_COUNT ); if ($maxIndex && count($indexesNeed) > $maxIndex) { - throw new \Magento\Framework\Exception\LocalizedException( + throw new LocalizedException( __( 'The Flat Catalog module has a limit of %2$d filterable and/or sortable attributes.' . 'Currently there are %1$d of them.' @@ -141,7 +152,7 @@ protected function _createTemporaryFlatTable($storeId) $indexKeys = []; $indexProps = array_values($indexesNeed); - $upperPrimaryKey = strtoupper(\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY); + $upperPrimaryKey = strtoupper(AdapterInterface::INDEX_TYPE_PRIMARY); foreach ($indexProps as $i => $indexProp) { $indexName = $this->_connection->getIndexName( $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)), @@ -164,7 +175,7 @@ protected function _createTemporaryFlatTable($storeId) } $indexesNeed = array_combine($indexKeys, $indexProps); - /** @var $table \Magento\Framework\DB\Ddl\Table */ + /** @var $table Table */ $table = $this->_connection->newTable( $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)) ); @@ -211,6 +222,8 @@ protected function _createTemporaryFlatTable($storeId) * @param int|string $storeId * @param string $valueFieldSuffix * @return void + * @throws LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldSuffix) { @@ -233,7 +246,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS ) ); - /* @var $status \Magento\Eav\Model\Entity\Attribute */ + /* @var $status Attribute */ $status = $this->_productIndexerHelper->getAttribute('status'); $statusTable = $this->_getTemporaryTableName($status->getBackendTable()); $statusConditions = [ @@ -262,7 +275,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS implode(' AND ', $statusConditions), [] )->where( - $statusExpression . ' = ' . \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED + $statusExpression . ' = ' . Status::STATUS_ENABLED ); foreach ($tables as $tableName => $columns) { @@ -319,7 +332,7 @@ protected function _updateTemporaryTableByStoreValues( $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField(); foreach ($tables as $tableName => $columns) { foreach ($columns as $attribute) { - /* @var $attribute \Magento\Eav\Model\Entity\Attribute */ + /* @var $attribute Attribute */ $attributeCode = $attribute->getAttributeCode(); if ($attribute->getBackend()->getType() != 'static') { $joinCondition = sprintf('t.%s = e.%s', $linkField, $linkField) . @@ -328,7 +341,7 @@ protected function _updateTemporaryTableByStoreValues( ' AND t.store_id = ' . $storeId . ' AND t.value IS NOT NULL'; - /** @var $select \Magento\Framework\DB\Select */ + /** @var $select Select */ $select = $this->_connection->select() ->joinInner( ['e' => $this->resource->getTableName('catalog_product_entity')], @@ -390,13 +403,13 @@ protected function _getTemporaryTableName($tableName) /** * Get metadata pool * - * @return \Magento\Framework\EntityManager\MetadataPool + * @return MetadataPool */ private function getMetadataPool() { if (null === $this->metadataPool) { - $this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\EntityManager\MetadataPool::class); + $this->metadataPool = ObjectManager::getInstance() + ->get(MetadataPool::class); } return $this->metadataPool; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Table/Builder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Table/Builder.php index fb9c8aace8d7d..23eaf7d7b2010 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Table/Builder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Table/Builder.php @@ -6,7 +6,7 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat\Table; /** - * Class Builder + * Build table structure based on provided columns */ class Builder implements BuilderInterface { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php index 1b4d61c899428..d32bd86d750ee 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php @@ -3,13 +3,31 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Indexer\Product\Price; +use Magento\Catalog\Model\Product\Type; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice; +use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Factory; +use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\PriceInterface; +use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\TierPrice; use Magento\Customer\Model\Indexer\CustomerGroupDimensionProvider; +use Magento\Directory\Model\Currency; +use Magento\Directory\Model\CurrencyFactory; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Exception\InputException; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Indexer\DimensionalIndexerInterface; +use Magento\Framework\Search\Request\Dimension; +use Magento\Framework\Stdlib\DateTime; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Store\Model\Indexer\WebsiteDimensionProvider; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\Website; /** * Abstract action reindex class @@ -26,48 +44,48 @@ abstract class AbstractAction protected $_defaultIndexerResource; /** - * @var \Magento\Framework\DB\Adapter\AdapterInterface + * @var AdapterInterface */ protected $_connection; /** * Core config model * - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $_config; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** * Currency factory * - * @var \Magento\Directory\Model\CurrencyFactory + * @var CurrencyFactory */ protected $_currencyFactory; /** - * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface + * @var TimezoneInterface */ protected $_localeDate; /** - * @var \Magento\Framework\Stdlib\DateTime + * @var DateTime */ protected $_dateTime; /** - * @var \Magento\Catalog\Model\Product\Type + * @var Type */ protected $_catalogProductType; /** * Indexer price factory * - * @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Factory + * @var Factory */ protected $_indexerPriceFactory; @@ -77,12 +95,12 @@ abstract class AbstractAction protected $_indexers; /** - * @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\TierPrice + * @var TierPrice */ private $tierPriceIndexResource; /** - * @var \Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory + * @var DimensionCollectionFactory */ private $dimensionCollectionFactory; @@ -92,15 +110,15 @@ abstract class AbstractAction private $tableMaintainer; /** - * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Catalog\Model\Product\Type $catalogProductType - * @param \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Factory $indexerPriceFactory + * @param ScopeConfigInterface $config + * @param StoreManagerInterface $storeManager + * @param CurrencyFactory $currencyFactory + * @param TimezoneInterface $localeDate + * @param DateTime $dateTime + * @param Type $catalogProductType + * @param Factory $indexerPriceFactory * @param DefaultPrice $defaultIndexerResource - * @param \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\TierPrice|null $tierPriceIndexResource + * @param TierPrice|null $tierPriceIndexResource * @param DimensionCollectionFactory|null $dimensionCollectionFactory * @param TableMaintainer|null $tableMaintainer * @SuppressWarnings(PHPMD.NPathComplexity) @@ -108,17 +126,17 @@ abstract class AbstractAction * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Catalog\Model\Product\Type $catalogProductType, - \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Factory $indexerPriceFactory, + ScopeConfigInterface $config, + StoreManagerInterface $storeManager, + CurrencyFactory $currencyFactory, + TimezoneInterface $localeDate, + DateTime $dateTime, + Type $catalogProductType, + Factory $indexerPriceFactory, DefaultPrice $defaultIndexerResource, - \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\TierPrice $tierPriceIndexResource = null, - \Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory $dimensionCollectionFactory = null, - \Magento\Catalog\Model\Indexer\Product\Price\TableMaintainer $tableMaintainer = null + TierPrice $tierPriceIndexResource = null, + DimensionCollectionFactory $dimensionCollectionFactory = null, + TableMaintainer $tableMaintainer = null ) { $this->_config = $config; $this->_storeManager = $storeManager; @@ -130,13 +148,13 @@ public function __construct( $this->_defaultIndexerResource = $defaultIndexerResource; $this->_connection = $this->_defaultIndexerResource->getConnection(); $this->tierPriceIndexResource = $tierPriceIndexResource ?? ObjectManager::getInstance()->get( - \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\TierPrice::class + TierPrice::class ); $this->dimensionCollectionFactory = $dimensionCollectionFactory ?? ObjectManager::getInstance()->get( - \Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory::class + DimensionCollectionFactory::class ); $this->tableMaintainer = $tableMaintainer ?? ObjectManager::getInstance()->get( - \Magento\Catalog\Model\Indexer\Product\Price\TableMaintainer::class + TableMaintainer::class ); } @@ -152,7 +170,7 @@ abstract public function execute($ids); * Synchronize data between index storage and original storage * * @param array $processIds - * @return \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction + * @return AbstractAction * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @deprecated Used only for backward compatibility for indexer, which not support indexation by dimensions */ @@ -182,14 +200,14 @@ protected function _syncData(array $processIds = []) /** * Prepare website current dates table * - * @return \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction + * @return AbstractAction * - * @throws \Magento\Framework\Exception\LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws LocalizedException + * @throws NoSuchEntityException */ protected function _prepareWebsiteDateTable() { - $baseCurrency = $this->_config->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); + $baseCurrency = $this->_config->getValue(Currency::XML_PATH_CURRENCY_BASE); $select = $this->getConnection()->select()->from( ['cw' => $this->_defaultIndexerResource->getTable('store_website')], @@ -204,7 +222,7 @@ protected function _prepareWebsiteDateTable() $data = []; foreach ($this->getConnection()->fetchAll($select) as $item) { - /** @var $website \Magento\Store\Model\Website */ + /** @var $website Website */ $website = $this->_storeManager->getWebsite($item['website_id']); if ($website->getBaseCurrencyCode() != $baseCurrency) { @@ -220,7 +238,7 @@ protected function _prepareWebsiteDateTable() $rate = 1; } - /** @var $store \Magento\Store\Model\Store */ + /** @var $store Store */ $store = $this->_storeManager->getStore($item['store_id']); if ($store) { $timestamp = $this->_localeDate->scopeTimeStamp($store); @@ -248,11 +266,11 @@ protected function _prepareWebsiteDateTable() * Prepare tier price index table * * @param int|array $entityIds the entity ids limitation - * @return \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction + * @return AbstractAction */ protected function _prepareTierPriceIndex($entityIds = null) { - $this->tierPriceIndexResource->reindexEntity((array) $entityIds); + $this->tierPriceIndexResource->reindexEntity((array)$entityIds); return $this; } @@ -262,9 +280,9 @@ protected function _prepareTierPriceIndex($entityIds = null) * * @param bool $fullReindexAction * - * @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\PriceInterface[] + * @return PriceInterface[] * - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ public function getTypeIndexers($fullReindexAction = false) { @@ -301,16 +319,16 @@ public function getTypeIndexers($fullReindexAction = false) * Retrieve Price indexer by Product Type * * @param string $productTypeId - * @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\PriceInterface + * @return PriceInterface * - * @throws \Magento\Framework\Exception\InputException - * @throws \Magento\Framework\Exception\LocalizedException + * @throws InputException + * @throws LocalizedException */ protected function _getIndexer($productTypeId) { $this->getTypeIndexers(); if (!isset($this->_indexers[$productTypeId])) { - throw new \Magento\Framework\Exception\InputException(__('Unsupported product type "%1".', $productTypeId)); + throw new InputException(__('Unsupported product type "%1".', $productTypeId)); } return $this->_indexers[$productTypeId]; } @@ -335,7 +353,7 @@ protected function _insertFromTable($sourceTable, $destTable, $where = null) $select, $destTable, $targetColumns, - \Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE + AdapterInterface::INSERT_ON_DUPLICATE ); $this->getConnection()->query($query); } @@ -357,9 +375,9 @@ protected function _emptyTable($table) * @param array $changedIds * @return array Affected ids * - * @throws \Magento\Framework\Exception\InputException - * @throws \Magento\Framework\Exception\LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws InputException + * @throws LocalizedException + * @throws NoSuchEntityException */ protected function _reindexRows($changedIds = []) { @@ -401,6 +419,8 @@ protected function _reindexRows($changedIds = []) } /** + * Cleanup index for list of entities + * * @param array $entityIds * @return void */ @@ -421,7 +441,7 @@ private function deleteIndexData(array $entityIds) * * @param null|array $parentIds * @param array $excludeIds - * @return \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction + * @return AbstractAction * @deprecated Used only for backward compatibility for do not broke custom indexer implementation * which do not work by dimensions. * For indexers, which support dimensions all composite products read data directly from main price indexer table @@ -468,7 +488,7 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null) * * This method is used during both partial and full reindex to identify the table. * - * @param \Magento\Framework\Search\Request\Dimension[] $dimensions + * @param Dimension[] $dimensions * * @return string */ @@ -564,7 +584,7 @@ private function getParentProductsTypes(array $productsIds) /** * Get connection * - * @return \Magento\Framework\DB\Adapter\AdapterInterface + * @return AdapterInterface */ private function getConnection() { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php b/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php index 5211f7470afc2..de9d60b77033a 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php @@ -27,7 +27,7 @@ public function __construct(CollectionFactory $productCollectionFactory) } /** - * {@inheritdoc} + * @inheritdoc */ public function findAttributeSetIdsByProductIds(array $productIds) { diff --git a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php index 0b8baa56243b3..41833a1894683 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php +++ b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php @@ -6,8 +6,16 @@ namespace Magento\Catalog\Model\Product\Price; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Model\ProductIdLocatorInterface; +use Magento\Catalog\Model\ResourceModel\Attribute; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\Exception\CouldNotDeleteException; +use Magento\Framework\Exception\CouldNotSaveException; + /** - * Price persistence. + * Class responsibly for persistence of prices. */ class PricePersistence { @@ -19,24 +27,24 @@ class PricePersistence private $table = 'catalog_product_entity_decimal'; /** - * @var \Magento\Catalog\Model\ResourceModel\Attribute + * @var Attribute */ private $attributeResource; /** - * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface + * @var ProductAttributeRepositoryInterface */ private $attributeRepository; /** - * @var \Magento\Catalog\Model\ProductIdLocatorInterface + * @var ProductIdLocatorInterface */ private $productIdLocator; /** * Metadata pool. * - * @var \Magento\Framework\EntityManager\MetadataPool + * @var MetadataPool */ private $metadataPool; @@ -64,17 +72,17 @@ class PricePersistence /** * PricePersistence constructor. * - * @param \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource - * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository - * @param \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator - * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool + * @param Attribute $attributeResource + * @param ProductAttributeRepositoryInterface $attributeRepository + * @param ProductIdLocatorInterface $productIdLocator + * @param MetadataPool $metadataPool * @param string $attributeCode */ public function __construct( - \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource, - \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, - \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator, - \Magento\Framework\EntityManager\MetadataPool $metadataPool, + Attribute $attributeResource, + ProductAttributeRepositoryInterface $attributeRepository, + ProductIdLocatorInterface $productIdLocator, + MetadataPool $metadataPool, $attributeCode = '' ) { $this->attributeResource = $attributeResource; @@ -107,7 +115,7 @@ public function get(array $skus) * * @param array $prices * @return void - * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws CouldNotSaveException */ public function update(array $prices) { @@ -127,7 +135,7 @@ public function update(array $prices) $connection->commit(); } catch (\Exception $e) { $connection->rollBack(); - throw new \Magento\Framework\Exception\CouldNotSaveException( + throw new CouldNotSaveException( __('Could not save Prices.'), $e ); @@ -139,7 +147,7 @@ public function update(array $prices) * * @param array $skus * @return void - * @throws \Magento\Framework\Exception\CouldNotDeleteException + * @throws CouldNotDeleteException */ public function delete(array $skus) { @@ -159,7 +167,7 @@ public function delete(array $skus) $connection->commit(); } catch (\Exception $e) { $connection->rollBack(); - throw new \Magento\Framework\Exception\CouldNotDeleteException( + throw new CouldNotDeleteException( __('Could not delete Prices'), $e ); @@ -209,10 +217,10 @@ private function retrieveAffectedIds(array $skus) $affectedIds = []; foreach ($this->productIdLocator->retrieveProductIdsBySkus($skus) as $productIds) { - $affectedIds = array_merge($affectedIds, array_keys($productIds)); + $affectedIds[] = array_keys($productIds); } - return array_unique($affectedIds); + return array_unique(array_merge(...$affectedIds)); } /** @@ -222,7 +230,7 @@ private function retrieveAffectedIds(array $skus) */ public function getEntityLinkField() { - return $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class) + return $this->metadataPool->getMetadata(ProductInterface::class) ->getLinkField(); } } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index 86868a7b28ff6..e6b822df04727 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -1079,7 +1079,6 @@ public function countVisible() */ public function load($object, $entityId, $attributes = []) { - $this->_attributes = []; $select = $this->_getLoadRowSelect($object, $entityId); $row = $this->getConnection()->fetchRow($select); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 7d702eb76e555..82cd3b54841a7 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -6,12 +6,32 @@ namespace Magento\Catalog\Model\ResourceModel\Product\Link\Product; use Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer; +use Magento\Catalog\Model\Indexer\Product\Flat\State; use Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Link; +use Magento\Catalog\Model\Product\OptionFactory; use Magento\Catalog\Model\ResourceModel\Category; +use Magento\Catalog\Model\ResourceModel\Helper; use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory; +use Magento\Catalog\Model\ResourceModel\Url; use Magento\Customer\Api\GroupManagementInterface; +use Magento\Customer\Model\Session; +use Magento\Eav\Model\Config; +use Magento\Eav\Model\EntityFactory; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; +use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\Event\ManagerInterface; use Magento\Framework\Indexer\DimensionFactory; +use Magento\Framework\Module\Manager; +use Magento\Framework\Stdlib\DateTime; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\Validator\UniversalFactory; +use Magento\Store\Model\StoreManagerInterface; +use Psr\Log\LoggerInterface; /** * Catalog product linked products collection @@ -26,14 +46,14 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection /** * Store product model * - * @var \Magento\Catalog\Model\Product + * @var Product */ protected $_product; /** * Store product link model * - * @var \Magento\Catalog\Model\Product\Link + * @var Link */ protected $_linkModel; @@ -71,25 +91,25 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection /** * Collection constructor. * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Framework\App\ResourceConnection $resource - * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory - * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper - * @param \Magento\Framework\Validator\UniversalFactory $universalFactory - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\Module\Manager $moduleManager - * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory - * @param \Magento\Catalog\Model\ResourceModel\Url $catalogUrl - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Framework\Stdlib\DateTime $dateTime + * @param LoggerInterface $logger + * @param FetchStrategyInterface $fetchStrategy + * @param ManagerInterface $eventManager + * @param Config $eavConfig + * @param ResourceConnection $resource + * @param EntityFactory $eavEntityFactory + * @param Helper $resourceHelper + * @param UniversalFactory $universalFactory + * @param StoreManagerInterface $storeManager + * @param Manager $moduleManager + * @param State $catalogProductFlatState + * @param ScopeConfigInterface $scopeConfig + * @param OptionFactory $productOptionFactory + * @param Url $catalogUrl + * @param TimezoneInterface $localeDate + * @param Session $customerSession + * @param DateTime $dateTime * @param GroupManagementInterface $groupManagement - * @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection + * @param AdapterInterface|null $connection * @param ProductLimitationFactory|null $productLimitationFactory * @param MetadataPool|null $metadataPool * @param TableMaintainer|null $tableMaintainer @@ -101,25 +121,25 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection */ public function __construct( \Magento\Framework\Data\Collection\EntityFactory $entityFactory, - \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Eav\Model\Config $eavConfig, - \Magento\Framework\App\ResourceConnection $resource, - \Magento\Eav\Model\EntityFactory $eavEntityFactory, - \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, - \Magento\Framework\Validator\UniversalFactory $universalFactory, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\Module\Manager $moduleManager, - \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, - \Magento\Catalog\Model\ResourceModel\Url $catalogUrl, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Customer\Model\Session $customerSession, - \Magento\Framework\Stdlib\DateTime $dateTime, + LoggerInterface $logger, + FetchStrategyInterface $fetchStrategy, + ManagerInterface $eventManager, + Config $eavConfig, + ResourceConnection $resource, + EntityFactory $eavEntityFactory, + Helper $resourceHelper, + UniversalFactory $universalFactory, + StoreManagerInterface $storeManager, + Manager $moduleManager, + State $catalogProductFlatState, + ScopeConfigInterface $scopeConfig, + OptionFactory $productOptionFactory, + Url $catalogUrl, + TimezoneInterface $localeDate, + Session $customerSession, + DateTime $dateTime, GroupManagementInterface $groupManagement, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, + AdapterInterface $connection = null, ProductLimitationFactory $productLimitationFactory = null, MetadataPool $metadataPool = null, TableMaintainer $tableMaintainer = null, @@ -166,10 +186,10 @@ public function __construct( /** * Declare link model and initialize type attributes join * - * @param \Magento\Catalog\Model\Product\Link $linkModel + * @param Link $linkModel * @return $this */ - public function setLinkModel(\Magento\Catalog\Model\Product\Link $linkModel) + public function setLinkModel(Link $linkModel) { $this->_linkModel = $linkModel; if ($linkModel->getLinkTypeId()) { @@ -192,7 +212,7 @@ public function setIsStrongMode() /** * Retrieve collection link model * - * @return \Magento\Catalog\Model\Product\Link + * @return Link */ public function getLinkModel() { @@ -202,10 +222,10 @@ public function getLinkModel() /** * Initialize collection parent product and add limitation join * - * @param \Magento\Catalog\Model\Product $product + * @param Product $product * @return $this */ - public function setProduct(\Magento\Catalog\Model\Product $product) + public function setProduct(Product $product) { $this->_product = $product; if ($product && $product->getId()) { @@ -219,7 +239,7 @@ public function setProduct(\Magento\Catalog\Model\Product $product) /** * Retrieve collection base product object * - * @return \Magento\Catalog\Model\Product + * @return Product */ public function getProduct() { @@ -257,7 +277,11 @@ public function addProductFilter($products) $products = [$products]; } $identifierField = $this->getLinkField(); - $this->getSelect()->where("product_entity_table.$identifierField IN (?)", $products, \Zend_Db::BIGINT_TYPE); + $this->getSelect()->where( + "product_entity_table.$identifierField IN (?)", + $products, + \Zend_Db::BIGINT_TYPE + ); $this->_hasLinkFilter = true; } diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php index 6ffa6f4a1169b..65b568fc39777 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php @@ -5,9 +5,18 @@ */ namespace Magento\CatalogInventory\Model\ResourceModel\Stock; +use Magento\Catalog\Model\Product; use Magento\CatalogInventory\Api\StockConfigurationInterface; use Magento\CatalogInventory\Model\Stock; +use Magento\Eav\Model\Config; use Magento\Framework\App\ObjectManager; +use Magento\Framework\DB\Select; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Context; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\Website; +use Magento\Store\Model\WebsiteFactory; /** * CatalogInventory Stock Status per website Resource Model @@ -18,12 +27,12 @@ * @link https://devdocs.magento.com/guides/v2.3/inventory/index.html * @link https://devdocs.magento.com/guides/v2.3/inventory/catalog-inventory-replacements.html */ -class Status extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb +class Status extends AbstractDb { /** * Store model manager * - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface * @deprecated 100.1.0 */ protected $_storeManager; @@ -31,12 +40,12 @@ class Status extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb /** * Website model factory * - * @var \Magento\Store\Model\WebsiteFactory + * @var WebsiteFactory */ protected $_websiteFactory; /** - * @var \Magento\Eav\Model\Config + * @var Config */ protected $eavConfig; @@ -46,18 +55,18 @@ class Status extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb private $stockConfiguration; /** - * @param \Magento\Framework\Model\ResourceModel\Db\Context $context - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Store\Model\WebsiteFactory $websiteFactory - * @param \Magento\Eav\Model\Config $eavConfig + * @param Context $context + * @param StoreManagerInterface $storeManager + * @param WebsiteFactory $websiteFactory + * @param Config $eavConfig * @param string $connectionName - * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration + * @param StockConfigurationInterface $stockConfiguration */ public function __construct( - \Magento\Framework\Model\ResourceModel\Db\Context $context, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Store\Model\WebsiteFactory $websiteFactory, - \Magento\Eav\Model\Config $eavConfig, + Context $context, + StoreManagerInterface $storeManager, + WebsiteFactory $websiteFactory, + Config $eavConfig, $connectionName = null, $stockConfiguration = null ) { @@ -127,6 +136,7 @@ public function saveProductStatus( /** * Retrieve product status + * * Return array as key product id, value - stock status * * @param int[] $productIds @@ -150,13 +160,14 @@ public function getProductsStockStatuses($productIds, $websiteId, $stockId = Sto /** * Retrieve websites and default stores + * * Return array as key website_id, value store_id * * @return array */ public function getWebsiteStores() { - /** @var \Magento\Store\Model\Website $website */ + /** @var Website $website */ $website = $this->_websiteFactory->create(); return $this->getConnection()->fetchPairs($website->getDefaultStoresSelect(false)); } @@ -185,6 +196,7 @@ public function getProductsType($productIds) /** * Retrieve Product part Collection array + * * Return array as key product id, value product type * * @param int $lastEntityId @@ -206,12 +218,12 @@ public function getProductCollection($lastEntityId = 0, $limit = 1000) /** * Add stock status to prepare index select * - * @param \Magento\Framework\DB\Select $select - * @param \Magento\Store\Model\Website $website + * @param Select $select + * @param Website $website * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @return Status */ - public function addStockStatusToSelect(\Magento\Framework\DB\Select $select, \Magento\Store\Model\Website $website) + public function addStockStatusToSelect(Select $select, Website $website) { $websiteId = $this->getWebsiteId($website->getId()); $select->joinLeft( @@ -224,6 +236,8 @@ public function addStockStatusToSelect(\Magento\Framework\DB\Select $select, \Ma } /** + * Add Stock information to Product Collection + * * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection * @param bool $isFilterInStock * @return \Magento\Catalog\Model\ResourceModel\Product\Collection $collection @@ -287,7 +301,9 @@ public function addIsInStockFilterToCollection($collection) } /** - * @param \Magento\Store\Model\Website $websiteId + * Get website with fallback to default + * + * @param Website $websiteId * @return int */ private function getWebsiteId($websiteId = null) @@ -313,17 +329,17 @@ public function getProductStatus($productIds, $storeId = null) $productIds = [$productIds]; } - $attribute = $this->eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'status'); + $attribute = $this->eavConfig->getAttribute(Product::ENTITY, 'status'); $attributeTable = $attribute->getBackend()->getTable(); $linkField = $attribute->getEntity()->getLinkField(); $connection = $this->getConnection(); - if ($storeId === null || $storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { + if ($storeId === null || $storeId == Store::DEFAULT_STORE_ID) { $select = $connection->select()->from($attributeTable, [$linkField, 'value']) ->where("{$linkField} IN (?)", $productIds, \Zend_Db::BIGINT_TYPE) ->where('attribute_id = ?', $attribute->getAttributeId()) - ->where('store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); + ->where('store_id = ?', Store::DEFAULT_STORE_ID); $rows = $connection->fetchPairs($select); } else { @@ -335,7 +351,7 @@ public function getProductStatus($productIds, $storeId = null) "t1.{$linkField} = t2.{$linkField} AND t1.attribute_id = t2.attribute_id AND t2.store_id = {$storeId}" )->where( 't1.store_id = ?', - \Magento\Store\Model\Store::DEFAULT_STORE_ID + Store::DEFAULT_STORE_ID )->where( 't1.attribute_id = ?', $attribute->getAttributeId() diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php index d6e8033987ee8..2233c6e60ae08 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php +++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php @@ -27,12 +27,14 @@ public function __construct(\Magento\Framework\App\ResourceConnection $resource) } /** + * Return list of ID for product variation + * * @param array $ids * @return array */ public function getIds(array $ids) { - $key = md5(json_encode($ids)); + $key = md5(json_encode($ids)); //phpcs:ignore if (!isset($this->productIds[$key])) { $connection = $this->resource->getConnection(); $this->productIds[$key] = $connection->fetchCol( diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php index c8e761fb5ed22..7b58ab96f765e 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php @@ -8,7 +8,7 @@ namespace Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product; /** - * Class Collection + * Collection of configurable product variation * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php index e54f888b0ffab..c7b0225576d1b 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php @@ -6,7 +6,17 @@ namespace Magento\Eav\Model\ResourceModel\Entity\Attribute; +use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Type; +use Magento\Eav\Model\ResourceModel\Entity\Attribute; +use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; +use Magento\Framework\Data\Collection\EntityFactoryInterface; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\DB\Select; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; +use Psr\Log\LoggerInterface; /** * EAV attribute resource collection @@ -14,8 +24,9 @@ * @api * @author Magento Core Team * @since 100.0.2 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection +class Collection extends AbstractCollection { /** * Add attribute set info flag @@ -25,28 +36,28 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab protected $_addSetInfoFlag = false; /** - * @var \Magento\Eav\Model\Config + * @var Config */ protected $eavConfig; /** - * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection - * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource + * @param EntityFactoryInterface $entityFactory + * @param LoggerInterface $logger + * @param FetchStrategyInterface $fetchStrategy + * @param ManagerInterface $eventManager + * @param Config $eavConfig + * @param AdapterInterface $connection + * @param AbstractDb $resource * @codeCoverageIgnore */ public function __construct( - \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, - \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Eav\Model\Config $eavConfig, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + EntityFactoryInterface $entityFactory, + LoggerInterface $logger, + FetchStrategyInterface $fetchStrategy, + ManagerInterface $eventManager, + Config $eavConfig, + AdapterInterface $connection = null, + AbstractDb $resource = null ) { $this->eavConfig = $eavConfig; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); @@ -62,7 +73,7 @@ protected function _construct() { $this->_init( \Magento\Eav\Model\Entity\Attribute::class, - \Magento\Eav\Model\ResourceModel\Entity\Attribute::class + Attribute::class ); } @@ -94,7 +105,7 @@ protected function _getLoadDataFields() */ public function useLoadDataFields() { - $this->getSelect()->reset(\Magento\Framework\DB\Select::COLUMNS); + $this->getSelect()->reset(Select::COLUMNS); $this->getSelect()->columns($this->_getLoadDataFields()); return $this; @@ -161,11 +172,11 @@ public function setAttributeSetFilter($setId) * * @param string $attributeSetName * @param string $entityTypeCode - * @return void + * @return Collection + * @throws \Magento\Framework\Exception\LocalizedException */ public function setAttributeSetFilterBySetName($attributeSetName, $entityTypeCode) { - //@codeCoverageIgnoreStart $entityTypeId = $this->eavConfig->getEntityType($entityTypeCode)->getId(); $this->join( ['entity_attribute' => $this->getTable('eav_entity_attribute')], @@ -179,7 +190,8 @@ public function setAttributeSetFilterBySetName($attributeSetName, $entityTypeCod $this->addFieldToFilter('attribute_set.entity_type_id', $entityTypeId); $this->addFieldToFilter('attribute_set.attribute_set_name', $attributeSetName); $this->setOrder('entity_attribute.sort_order', self::SORT_ORDER_ASC); - //@codeCoverageIgnoreEnd + + return $this; } /** @@ -428,7 +440,7 @@ protected function _addSetInfo() /** * Ad information about attribute sets to collection result data * - * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection + * @return AbstractCollection */ protected function _afterLoadData() { @@ -483,7 +495,7 @@ public function addStoreLabel($storeId) public function getSelectCountSql() { $countSelect = parent::getSelectCountSql(); - $countSelect->reset(\Magento\Framework\DB\Select::COLUMNS); + $countSelect->reset(Select::COLUMNS); $countSelect->columns('COUNT(DISTINCT main_table.attribute_id)'); return $countSelect; } From 00f13770e230b5ec4366fa429a2cc77a099f26f7 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 10 May 2020 21:15:52 -0500 Subject: [PATCH 14/33] Improve code quality. Return part of changes --- .../Model/ResourceModel/Index.php | 24 +++++----- .../Indexer/Product/Flat/FlatTableBuilder.php | 45 +++++++------------ .../Indexer/Product/Flat/TableBuilder.php | 4 +- .../Product/Link/Product/Collection.php | 18 +++++--- .../Model/ResourceModel/Stock/Status.php | 1 + .../Entity/Attribute/Collection.php | 9 ++-- .../Magento/TestFramework/Helper/Memory.php | 8 ++++ 7 files changed, 52 insertions(+), 57 deletions(-) diff --git a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php index bf6a62f36e440..b20872da2f8e7 100644 --- a/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php +++ b/app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php @@ -5,19 +5,18 @@ */ namespace Magento\AdvancedSearch\Model\ResourceModel; -use Magento\Catalog\Api\Data\CategoryInterface; -use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction; -use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; -use Magento\Framework\App\ObjectManager; -use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Search\Request\IndexScopeResolverInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\Model\ResourceModel\Db\Context; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Catalog\Api\Data\CategoryInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Search\Request\Dimension; -use Magento\Framework\Search\Request\IndexScopeResolverInterface; +use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction; use Magento\Framework\Search\Request\IndexScopeResolverInterface as TableResolver; +use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory; use Magento\Store\Model\Indexer\WebsiteDimensionProvider; -use Magento\Store\Model\Store; -use Magento\Store\Model\StoreManagerInterface; /** * @api @@ -56,7 +55,6 @@ class Index extends AbstractDb /** * Index constructor. - * * @param Context $context * @param StoreManagerInterface $storeManager * @param MetadataPool $metadataPool @@ -82,9 +80,7 @@ public function __construct( /** * Implementation of abstract construct - * * @return void - * @SuppressWarnings(PHPMD) * @since 100.1.0 */ protected function _construct() @@ -112,7 +108,7 @@ protected function _getCatalogProductPriceData($productIds = null) ['entity_id', 'customer_group_id', 'website_id', 'min_price'] ); if ($productIds) { - $select->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE); + $select->where('entity_id IN (?)', $productIds); } $catalogProductIndexPriceSelect[] = $select; } @@ -163,7 +159,7 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null) { $connection = $this->getConnection(); - $catalogCategoryProductDimension = new Dimension(Store::ENTITY, $storeId); + $catalogCategoryProductDimension = new Dimension(\Magento\Store\Model\Store::ENTITY, $storeId); $catalogCategoryProductTableName = $this->tableResolver->resolve( AbstractAction::MAIN_INDEX_TABLE, @@ -181,7 +177,7 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null) ); if ($productIds) { - $select->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE); + $select->where('product_id IN (?)', $productIds); } $result = []; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index e92778226aadd..d6decee249c04 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -6,18 +6,8 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat; use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Catalog\Helper\Product\Flat\Indexer; -use Magento\Catalog\Model\Product\Attribute\Source\Status; -use Magento\Eav\Model\Entity\Attribute; -use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ResourceConnection; -use Magento\Framework\DB\Adapter\AdapterInterface; -use Magento\Framework\DB\Ddl\Table; -use Magento\Framework\DB\Select; use Magento\Framework\EntityManager\MetadataPool; -use Magento\Framework\Exception\LocalizedException; -use Magento\Store\Model\StoreManagerInterface; /** * Class for building flat index @@ -37,22 +27,22 @@ class FlatTableBuilder const XML_NODE_MAX_INDEX_COUNT = 'catalog/product/flat/max_index_count'; /** - * @var Indexer + * @var \Magento\Catalog\Helper\Product\Flat\Indexer */ protected $_productIndexerHelper; /** - * @var AdapterInterface + * @var \Magento\Framework\DB\Adapter\AdapterInterface */ protected $_connection; /** - * @var ScopeConfigInterface $config + * @var \Magento\Framework\App\Config\ScopeConfigInterface $config */ protected $_config; /** - * @var StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -62,23 +52,23 @@ class FlatTableBuilder protected $_tableData; /** - * @var ResourceConnection + * @var \Magento\Framework\App\ResourceConnection */ protected $resource; /** - * @param Indexer $productIndexerHelper + * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper * @param ResourceConnection $resource - * @param ScopeConfigInterface $config - * @param StoreManagerInterface $storeManager + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param TableDataInterface $tableData */ public function __construct( - Indexer $productIndexerHelper, - ResourceConnection $resource, - ScopeConfigInterface $config, - StoreManagerInterface $storeManager, - TableDataInterface $tableData + \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper, + \Magento\Framework\App\ResourceConnection $resource, + \Magento\Framework\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData ) { $this->_productIndexerHelper = $productIndexerHelper; $this->resource = $resource; @@ -124,8 +114,7 @@ public function build($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix * * @param int|string $storeId * @return void - * @throws LocalizedException - * @throws \Zend_Db_Exception + * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -139,7 +128,7 @@ protected function _createTemporaryFlatTable($storeId) self::XML_NODE_MAX_INDEX_COUNT ); if ($maxIndex && count($indexesNeed) > $maxIndex) { - throw new LocalizedException( + throw new \Magento\Framework\Exception\LocalizedException( __( 'The Flat Catalog module has a limit of %2$d filterable and/or sortable attributes.' . 'Currently there are %1$d of them.' @@ -152,7 +141,7 @@ protected function _createTemporaryFlatTable($storeId) $indexKeys = []; $indexProps = array_values($indexesNeed); - $upperPrimaryKey = strtoupper(AdapterInterface::INDEX_TYPE_PRIMARY); + $upperPrimaryKey = strtoupper(\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY); foreach ($indexProps as $i => $indexProp) { $indexName = $this->_connection->getIndexName( $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)), @@ -175,7 +164,7 @@ protected function _createTemporaryFlatTable($storeId) } $indexesNeed = array_combine($indexKeys, $indexProps); - /** @var $table Table */ + /** @var $table \Magento\Framework\DB\Ddl\Table */ $table = $this->_connection->newTable( $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)) ); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php index c0632c6c246ce..376884cd88db5 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php @@ -233,9 +233,7 @@ protected function _fillTemporaryEntityTable($tableName, array $columns, array $ $select->from(['e' => $tableName], $columns); $onDuplicate = false; if (!empty($changedIds)) { - $select->where( - $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) - ); + $select->where($this->_connection->quoteInto('e.entity_id IN (?)', $changedIds)); $onDuplicate = true; } $sql = $select->insertFromSelect($temporaryEntityTable, $columns, $onDuplicate); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 82cd3b54841a7..5a7ad23173f9f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -9,7 +9,7 @@ use Magento\Catalog\Model\Indexer\Product\Flat\State; use Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver; use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\Product\Link; +use Magento\Catalog\Model\Product\Link as LinkModel; use Magento\Catalog\Model\Product\OptionFactory; use Magento\Catalog\Model\ResourceModel\Category; use Magento\Catalog\Model\ResourceModel\Helper; @@ -53,7 +53,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection /** * Store product link model * - * @var Link + * @var LinkModel */ protected $_linkModel; @@ -186,10 +186,10 @@ public function __construct( /** * Declare link model and initialize type attributes join * - * @param Link $linkModel + * @param LinkModel $linkModel * @return $this */ - public function setLinkModel(Link $linkModel) + public function setLinkModel(LinkModel $linkModel) { $this->_linkModel = $linkModel; if ($linkModel->getLinkTypeId()) { @@ -212,7 +212,7 @@ public function setIsStrongMode() /** * Retrieve collection link model * - * @return Link + * @return LinkModel */ public function getLinkModel() { @@ -239,7 +239,7 @@ public function setProduct(Product $product) /** * Retrieve collection base product object * - * @return Product + * @return \Magento\Catalog\Model\Product */ public function getProduct() { @@ -259,7 +259,11 @@ public function addExcludeProductFilter($products) $products = [$products]; } $this->_hasLinkFilter = true; - $this->getSelect()->where('links.linked_product_id NOT IN (?)', $products, \Zend_Db::BIGINT_TYPE); + $this->getSelect()->where( + 'links.linked_product_id NOT IN (?)', + $products, + \Zend_Db::BIGINT_TYPE + ); } return $this; } diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php index 65b568fc39777..fcfc197f9036d 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php @@ -317,6 +317,7 @@ private function getWebsiteId($websiteId = null) /** * Retrieve Product(s) status for store + * * Return array where key is a product_id, value - status * * @param int[] $productIds diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php index c7b0225576d1b..b354d8682e2d1 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php @@ -172,11 +172,11 @@ public function setAttributeSetFilter($setId) * * @param string $attributeSetName * @param string $entityTypeCode - * @return Collection - * @throws \Magento\Framework\Exception\LocalizedException + * @return void */ public function setAttributeSetFilterBySetName($attributeSetName, $entityTypeCode) { + //@codeCoverageIgnoreStart $entityTypeId = $this->eavConfig->getEntityType($entityTypeCode)->getId(); $this->join( ['entity_attribute' => $this->getTable('eav_entity_attribute')], @@ -190,8 +190,7 @@ public function setAttributeSetFilterBySetName($attributeSetName, $entityTypeCod $this->addFieldToFilter('attribute_set.entity_type_id', $entityTypeId); $this->addFieldToFilter('attribute_set.attribute_set_name', $attributeSetName); $this->setOrder('entity_attribute.sort_order', self::SORT_ORDER_ASC); - - return $this; + //@codeCoverageIgnoreEnd } /** @@ -440,7 +439,7 @@ protected function _addSetInfo() /** * Ad information about attribute sets to collection result data * - * @return AbstractCollection + * @return $this */ protected function _afterLoadData() { diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php index 933d86fe6a4f5..6c8ff4640b0ba 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php @@ -53,6 +53,7 @@ public function getRealMemoryUsage() // fall back to the Unix command line $result = $this->_getUnixProcessMemoryUsage($pid); } catch (\Magento\Framework\Exception\LocalizedException $e) { + echo $e; // try to use the Windows command line // some ports of Unix commands on Windows, such as MinGW, have limited capabilities and cannot be used $result = $this->_getWinProcessMemoryUsage($pid); @@ -69,6 +70,13 @@ public function getRealMemoryUsage() */ protected function _getUnixProcessMemoryUsage($pid) { + if (!$this->isMacOS() + && ($content = @file_get_contents('/proc/' . (int) $pid . '/status')) + && \preg_match('/VmRSS:\s*(\d* \w)/mi', $content, $m) + && !empty($m[1]) + ) { + return self::convertToBytes($m[1]); + } // RSS - resident set size, the non-swapped physical memory $command = 'ps --pid %s --format rss --no-headers'; if ($this->isMacOS()) { From 6587c575648d63c372aa725be93bc3c2fa9bc49b Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Sun, 10 May 2020 23:09:01 -0500 Subject: [PATCH 15/33] Improve code quality --- .../Indexer/Product/Flat/FlatTableBuilder.php | 65 ++++++++++++------- .../Indexer/Product/Flat/TableBuilder.php | 2 +- .../Indexer/Product/Price/AbstractAction.php | 3 + .../Product/Link/Product/Collection.php | 12 +++- .../Magento/TestFramework/Helper/Memory.php | 7 -- 5 files changed, 54 insertions(+), 35 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index d6decee249c04..8415c9f61199d 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -6,8 +6,19 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Helper\Product\Flat\Indexer; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\DB\Ddl\Table; use Magento\Framework\EntityManager\MetadataPool; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Framework\App\ObjectManager; +use Magento\Eav\Model\Entity\Attribute; +use Magento\Framework\DB\Select; /** * Class for building flat index @@ -27,22 +38,22 @@ class FlatTableBuilder const XML_NODE_MAX_INDEX_COUNT = 'catalog/product/flat/max_index_count'; /** - * @var \Magento\Catalog\Helper\Product\Flat\Indexer + * @var Indexer */ protected $_productIndexerHelper; /** - * @var \Magento\Framework\DB\Adapter\AdapterInterface + * @var AdapterInterface */ protected $_connection; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface $config + * @var ScopeConfigInterface $config */ protected $_config; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; @@ -52,23 +63,23 @@ class FlatTableBuilder protected $_tableData; /** - * @var \Magento\Framework\App\ResourceConnection + * @var ResourceConnection */ protected $resource; /** - * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper + * @param Indexer $productIndexerHelper * @param ResourceConnection $resource - * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param ScopeConfigInterface $config + * @param StoreManagerInterface $storeManager * @param TableDataInterface $tableData */ public function __construct( - \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper, - \Magento\Framework\App\ResourceConnection $resource, - \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData + Indexer $productIndexerHelper, + ResourceConnection $resource, + ScopeConfigInterface $config, + StoreManagerInterface $storeManager, + TableDataInterface $tableData ) { $this->_productIndexerHelper = $productIndexerHelper; $this->resource = $resource; @@ -114,7 +125,7 @@ public function build($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix * * @param int|string $storeId * @return void - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -128,7 +139,7 @@ protected function _createTemporaryFlatTable($storeId) self::XML_NODE_MAX_INDEX_COUNT ); if ($maxIndex && count($indexesNeed) > $maxIndex) { - throw new \Magento\Framework\Exception\LocalizedException( + throw new LocalizedException( __( 'The Flat Catalog module has a limit of %2$d filterable and/or sortable attributes.' . 'Currently there are %1$d of them.' @@ -141,7 +152,7 @@ protected function _createTemporaryFlatTable($storeId) $indexKeys = []; $indexProps = array_values($indexesNeed); - $upperPrimaryKey = strtoupper(\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY); + $upperPrimaryKey = strtoupper(AdapterInterface::INDEX_TYPE_PRIMARY); foreach ($indexProps as $i => $indexProp) { $indexName = $this->_connection->getIndexName( $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)), @@ -164,7 +175,7 @@ protected function _createTemporaryFlatTable($storeId) } $indexesNeed = array_combine($indexKeys, $indexProps); - /** @var $table \Magento\Framework\DB\Ddl\Table */ + /** @var $table Table */ $table = $this->_connection->newTable( $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)) ); @@ -212,7 +223,7 @@ protected function _createTemporaryFlatTable($storeId) * @param string $valueFieldSuffix * @return void * @throws LocalizedException - * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws NoSuchEntityException */ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldSuffix) { @@ -228,8 +239,8 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS $websiteId = (int)$this->_storeManager->getStore($storeId)->getWebsiteId(); unset($tables[$entityTableName]); - - $allColumns = array_values( + $allColumns = []; + $allColumns[] = array_values( array_unique( array_merge(['entity_id', $linkField, 'type_id', 'attribute_set_id'], $columnsList) ) @@ -278,7 +289,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS sprintf('e.%1$s = %2$s.%1$s', $linkField, $temporaryTableName), $columnsNames ); - $allColumns = array_merge($allColumns, $columnsNames); + $allColumns[] = $columnsNames; foreach ($columnsNames as $name) { $columnValueName = $name . $valueFieldSuffix; @@ -292,10 +303,10 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS sprintf('e.%1$s = %2$s.%1$s', $linkField, $temporaryValueTableName), $columnValueNames ); - $allColumns = array_merge($allColumns, $columnValueNames); + $allColumns[] = $columnValueNames; } } - $sql = $select->insertFromSelect($temporaryFlatTableName, $allColumns, false); + $sql = $select->insertFromSelect($temporaryFlatTableName, array_merge(...$allColumns), false); $this->_connection->query($sql); } @@ -368,8 +379,12 @@ protected function _updateTemporaryTableByStoreValues( )->where($columnValue . ' IS NOT NULL'); if (!empty($changedIds)) { $select->where( - $this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE)) - ; + $this->_connection->quoteInto( + 'et.entity_id IN (?)', + $changedIds, + \Zend_Db::BIGINT_TYPE + ) + ); } $sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]); $this->_connection->query($sql); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php index 376884cd88db5..199d5b73a8634 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php @@ -9,7 +9,7 @@ use Magento\Store\Model\Store; /** - * Class TableBuilder + * Prepare temporary tables structure for product flat indexer * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php index d32bd86d750ee..9ccca56a9cb1a 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php @@ -517,6 +517,8 @@ protected function getIndexTargetTable() } /** + * Return Product ID field name + * * @return string */ protected function getProductIdFieldName() @@ -553,6 +555,7 @@ private function getProductsTypes(array $changedIds = []) /** * Get parent products types + * * Used for add composite products to reindex if we have only simple products in changed ids set * * @param array $productsIds diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 5a7ad23173f9f..81569fb581273 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -347,10 +347,18 @@ protected function _joinLinks() $linkField = $this->getLinkField(); if ($this->productIds) { if ($this->_isStrongMode) { - $this->getSelect()->where('links.product_id in (?)', $this->productIds, \Zend_Db::BIGINT_TYPE); + $this->getSelect()->where( + 'links.product_id in (?)', + $this->productIds, + \Zend_Db::BIGINT_TYPE + ); } else { $joinType = 'joinLeft'; - $joinCondition[] = $connection->quoteInto('links.product_id in (?)', $this->productIds, \Zend_Db::BIGINT_TYPE); + $joinCondition[] = $connection->quoteInto( + 'links.product_id in (?)', + $this->productIds, + \Zend_Db::BIGINT_TYPE + ); } if (count($this->productIds) === 1) { $this->addFieldToFilter( diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php index 6c8ff4640b0ba..04be27d1c20e2 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php @@ -70,13 +70,6 @@ public function getRealMemoryUsage() */ protected function _getUnixProcessMemoryUsage($pid) { - if (!$this->isMacOS() - && ($content = @file_get_contents('/proc/' . (int) $pid . '/status')) - && \preg_match('/VmRSS:\s*(\d* \w)/mi', $content, $m) - && !empty($m[1]) - ) { - return self::convertToBytes($m[1]); - } // RSS - resident set size, the non-swapped physical memory $command = 'ps --pid %s --format rss --no-headers'; if ($this->isMacOS()) { From fd21e1f16ffd25a56225628d4edfa228d9aacb61 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 11 May 2020 12:25:44 -0500 Subject: [PATCH 16/33] Improve code quality --- .../Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index 8415c9f61199d..584eea02241db 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -261,7 +261,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS $select->from( ['et' => $entityTemporaryTableName], - $allColumns + array_merge(...$allColumns) )->joinInner( ['e' => $this->resource->getTableName('catalog_product_entity')], 'e.entity_id = et.entity_id', From e17a4b65f1daae3f17902c1d280f98909d5e20b0 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Mon, 11 May 2020 21:51:33 -0500 Subject: [PATCH 17/33] Improve code quality --- .../Magento/Catalog/Model/Product/Price/PricePersistence.php | 2 +- .../framework/Magento/TestFramework/Helper/Memory.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php index 41833a1894683..99c66bd9f5be1 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php +++ b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php @@ -214,7 +214,7 @@ private function getAttributeId() */ private function retrieveAffectedIds(array $skus) { - $affectedIds = []; + $affectedIds = [[]]; foreach ($this->productIdLocator->retrieveProductIdsBySkus($skus) as $productIds) { $affectedIds[] = array_keys($productIds); diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php index 04be27d1c20e2..933d86fe6a4f5 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php @@ -53,7 +53,6 @@ public function getRealMemoryUsage() // fall back to the Unix command line $result = $this->_getUnixProcessMemoryUsage($pid); } catch (\Magento\Framework\Exception\LocalizedException $e) { - echo $e; // try to use the Windows command line // some ports of Unix commands on Windows, such as MinGW, have limited capabilities and cannot be used $result = $this->_getWinProcessMemoryUsage($pid); From 9e1b438cf0d89cdfdf3360168853fdbe43d97a47 Mon Sep 17 00:00:00 2001 From: Andrii Kasian Date: Tue, 12 May 2020 18:25:07 -0500 Subject: [PATCH 18/33] Improve code quality --- .../Catalog/Model/Indexer/Category/Product/AbstractAction.php | 1 + app/code/Magento/Catalog/Model/ResourceModel/Product.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index 42e9e4309a08b..f80206bf8a7b6 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -15,6 +15,7 @@ use Magento\Framework\EntityManager\MetadataPool; use Magento\Store\Model\Store; +// phpcs:disable Magento2.Classes.AbstractApi /** * Class AbstractAction * diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product.php b/app/code/Magento/Catalog/Model/ResourceModel/Product.php index 747893875d23b..58fb7d09af674 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product.php @@ -227,6 +227,9 @@ public function getWebsiteIds($product) */ public function getWebsiteIdsByProductIds($productIds) { + if (!is_array($productIds) || empty($productIds)) { + return []; + } $select = $this->getConnection()->select()->from( $this->getProductWebsiteTable(), ['product_id', 'website_id'] From 7ad6cdf896125193d4397614c21a1b884286181a Mon Sep 17 00:00:00 2001 From: Denys Babenko Date: Fri, 22 May 2020 22:52:56 +0200 Subject: [PATCH 19/33] Added missing aclResource attribute to Backend Header AdminNotification Toolbar Block --- .../AdminNotification/view/adminhtml/layout/default.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml index eed6b53f34315..b71fbd40cadb7 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml +++ b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml @@ -20,7 +20,11 @@ template="Magento_AdminNotification::notification/window.phtml"/> - + From c3855c831a9e401f9bc1fc1cd5722debb7281f83 Mon Sep 17 00:00:00 2001 From: engcom-Echo Date: Thu, 25 Jun 2020 16:22:36 +0300 Subject: [PATCH 20/33] minor change --- .../Model/ForgotPasswordToken/GetCustomerByTokenTest.php | 2 +- .../Model/ForgotPasswordToken/GetCustomerByTokenTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php b/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php index 0de1912ee4f7e..67dbb136297ff 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ForgotPasswordToken/GetCustomerByTokenTest.php @@ -54,7 +54,7 @@ class GetCustomerByTokenTest extends TestCase */ private $model; - protected function setUp() + protected function setUp(): void { $this->searchCriteriaBuilderMock = $this->createMock(SearchCriteriaBuilder::class); $this->searchCriteriaMock = $this->createMock(SearchCriteria::class); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php index 10a30f10e96a7..55e9a9572d229 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ForgotPasswordToken/GetCustomerByTokenTest.php @@ -24,7 +24,7 @@ class GetCustomerByTokenTest extends TestCase */ private $customerByToken; - protected function setUp() + protected function setUp(): void { $this->objectManager = Bootstrap::getObjectManager(); $this->customerByToken = $this->objectManager->get(GetCustomerByToken::class); @@ -35,7 +35,8 @@ protected function setUp() */ public function testExecuteWithNoSuchEntityException(): void { - $this->expectExceptionMessage('No such entity with rp_token = ' . self::RESET_PASSWORD); + self::expectException(NoSuchEntityException::class); + self::expectExceptionMessage('No such entity with rp_token = ' . self::RESET_PASSWORD); $this->customerByToken->execute(self::RESET_PASSWORD); } } From cff0e9840e6058af103c04d1f947af0241e744c5 Mon Sep 17 00:00:00 2001 From: "vadim.malesh" Date: Tue, 30 Jun 2020 16:11:17 +0300 Subject: [PATCH 21/33] add mftf --- .../AdminNotificationToolbarSection.xml | 15 +++++ ...nSystemNotificationToolbarBlockAclTest.xml | 62 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 app/code/Magento/AdminNotification/Test/Mftf/Section/AdminNotificationToolbarSection.xml create mode 100644 app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml diff --git a/app/code/Magento/AdminNotification/Test/Mftf/Section/AdminNotificationToolbarSection.xml b/app/code/Magento/AdminNotification/Test/Mftf/Section/AdminNotificationToolbarSection.xml new file mode 100644 index 0000000000000..c4a9290cb5641 --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Mftf/Section/AdminNotificationToolbarSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml new file mode 100644 index 0000000000000..74e595c601f32 --- /dev/null +++ b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml @@ -0,0 +1,62 @@ + + + + + + + + + <description value="Admin should not see system notification toolbar block if acl not restricted"/> + <severity value="MAJOR"/> + <group value="menu"/> + </annotations> + <before> + <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> + + <actionGroup ref="AdminFillUserRoleRequiredDataActionGroup" stepKey="fillUserRoleRequiredData"> + <argument name="User" value="adminRole"/> + <argument name="restrictedRole" value="Stores"/> + </actionGroup> + <actionGroup ref="AdminUserClickRoleResourceTabActionGroup" stepKey="goToRoleResourcesTab" /> + <actionGroup ref="AdminAddRestrictedRoleActionGroup" stepKey="addRestrictedRoleStores"> + <argument name="User" value="adminRole"/> + <argument name="restrictedRole" value="Products"/> + </actionGroup> + <actionGroup ref="AdminUserSaveRoleActionGroup" stepKey="saveUserRole" /> + + <actionGroup ref="AdminCreateUserActionGroup" stepKey="createAdminUser"> + <argument name="role" value="adminRole"/> + <argument name="User" value="admin2"/> + </actionGroup> + + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> + </before> + <after> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsSaleRoleUser"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> + <!--Delete created data--> + <actionGroup ref="AdminUserOpenAdminRolesPageActionGroup" stepKey="navigateToUserRoleGrid"/> + <actionGroup ref="AdminDeleteRoleActionGroup" stepKey="deleteUserRole"> + <argument name="role" value="adminRole"/> + </actionGroup> + <actionGroup ref="AdminOpenAdminUsersPageActionGroup" stepKey="goToAllUsersPage"/> + <actionGroup ref="AdminDeleteNewUserActionGroup" stepKey="deleteUser"> + <argument name="userName" value="{{admin2.username}}"/> + </actionGroup> + </after> + + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsNewUser"> + <argument name="username" value="{{admin2.username}}"/> + <argument name="password" value="{{admin2.password}}"/> + </actionGroup> + + <waitForPageLoad stepKey="waitBeforePageLoad"/> + <dontSeeElement selector="{{AdminNotificationToolbarSection.notification}}" stepKey="doNotSeeNotificationBellIcon"/> + </test> +</tests> From 3d3c5c4e44f4c6896700a97dfa36ae7bdfa34e6b Mon Sep 17 00:00:00 2001 From: Vadim Malesh <51680850+engcom-Charlie@users.noreply.github.com> Date: Mon, 20 Jul 2020 13:58:07 +0300 Subject: [PATCH 22/33] add testCaseId --- .../Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml index 74e595c601f32..c174d1faed31a 100644 --- a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml +++ b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml @@ -14,6 +14,7 @@ <title value="Admin system notification toolbar block acl test"/> <description value="Admin should not see system notification toolbar block if acl not restricted"/> <severity value="MAJOR"/> + <testCaseId value="MC-36011"/> <group value="menu"/> </annotations> <before> From 912cfd8c1a4da5605168c8939c707d72df575326 Mon Sep 17 00:00:00 2001 From: Andrii Kasian <akasian@magento.com> Date: Thu, 30 Jul 2020 22:10:42 -0500 Subject: [PATCH 23/33] Fix condition checks --- lib/internal/Magento/Framework/DB/Select.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/DB/Select.php b/lib/internal/Magento/Framework/DB/Select.php index e28786568cc2c..1b0fc1a9ff7fa 100644 --- a/lib/internal/Magento/Framework/DB/Select.php +++ b/lib/internal/Magento/Framework/DB/Select.php @@ -115,7 +115,7 @@ public function where($cond, $value = null, $type = null) { if ($value === null && $type === null) { $value = ''; - } elseif ($type == self::TYPE_CONDITION) { + } elseif ((string)$type === self::TYPE_CONDITION) { $type = null; } if (is_array($value)) { From 18f7d85e9218e235946aec7aad3fe2190346bdbf Mon Sep 17 00:00:00 2001 From: Andrii Kasian <akasian@magento.com> Date: Thu, 30 Jul 2020 23:39:27 -0500 Subject: [PATCH 24/33] Fix static test --- .../Product/Type/Configurable/Attribute/Collection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php index 6920e4e789335..f699eae23e359 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php @@ -41,8 +41,8 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab * Product instance * * @var \Magento\Catalog\Model\Product - * @deprecated 100.3.0 Now collection supports fetching options for multiple products. This field will be set to first - * element of products array. + * @deprecated 100.3.0 Now collection supports fetching options for multiple products. + * This field will be set to first element of products array. */ protected $_product; From 88f10c57649a763e62d7076016b3846e6e8b9786 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <svizev.igor@gmail.com> Date: Fri, 21 Aug 2020 14:34:54 +0300 Subject: [PATCH 25/33] Improve performance of "in" condition on some version of MySQL Fix static test, SVC failures and apply requested changes --- .../ResourceModel/Selection/Collection.php | 4 +-- .../Model/Resolver/Links/Collection.php | 2 +- .../Indexer/Category/Flat/AbstractAction.php | 6 ++-- .../Indexer/Category/Flat/Action/Rows.php | 2 +- .../Category/Product/AbstractAction.php | 2 +- .../Indexer/Category/Product/Action/Full.php | 2 +- .../Indexer/Product/Category/Action/Rows.php | 10 +++---- .../Indexer/Product/Flat/FlatTableBuilder.php | 4 +-- .../Indexer/Product/Flat/TableBuilder.php | 4 +-- .../Indexer/Product/Price/AbstractAction.php | 4 +-- .../Product/Attribute/AttributeSetFinder.php | 2 +- .../Model/Product/Price/PricePersistence.php | 6 ++-- .../Product/Price/TierPricePersistence.php | 2 +- .../Model/ResourceModel/AbstractResource.php | 6 ++-- .../Catalog/Model/ResourceModel/Category.php | 2 +- .../Model/ResourceModel/Category/Flat.php | 4 +-- .../Collection/AbstractCollection.php | 8 +++--- .../Catalog/Model/ResourceModel/Product.php | 7 +++-- .../ResourceModel/Product/Collection.php | 8 +++--- .../Model/ResourceModel/Product/Gallery.php | 2 +- .../Product/Indexer/Price/DefaultPrice.php | 2 +- .../Product/Indexer/Price/TierPrice.php | 2 +- .../Product/Link/Product/Collection.php | 10 +++---- .../Model/ResourceModel/Product/Website.php | 2 +- .../Model/Indexer/ProductPriceIndexFilter.php | 2 +- .../Model/Indexer/Stock/CacheCleaner.php | 2 +- .../Model/ResourceModel/Stock.php | 6 ++-- .../Model/ResourceModel/Stock/Status.php | 2 +- .../Indexer/ProductPriceIndexModifier.php | 2 +- .../Model/ConfigurableProductsProvider.php | 2 +- .../Indexer/Fulltext/Action/DataProvider.php | 4 +-- .../Model/Indexer/Fulltext/Action/Full.php | 2 +- .../Model/ResourceModel/Fulltext.php | 2 +- .../Model/ResourceModel/Search/Collection.php | 4 +-- .../Product/Indexer/Price/Configurable.php | 2 +- .../Product/Type/Configurable.php | 2 +- .../Configurable/Attribute/Collection.php | 2 +- .../Type/Configurable/Product/Collection.php | 2 +- .../Entity/Collection/AbstractCollection.php | 28 +++++++++++-------- .../Model/ResourceModel/Entity/Attribute.php | 2 +- .../Entity/Attribute/Collection.php | 6 ++-- .../Eav/Model/ResourceModel/ReadHandler.php | 2 +- 42 files changed, 91 insertions(+), 86 deletions(-) diff --git a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php index 11c83622a3b54..303c33b571d35 100644 --- a/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php +++ b/app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php @@ -215,7 +215,7 @@ public function joinPrices($websiteId) public function setOptionIdsFilter($optionIds) { if (!empty($optionIds)) { - $this->getSelect()->where('selection.option_id IN (?)', $optionIds, \Zend_Db::BIGINT_TYPE); + $this->getSelect()->where('selection.option_id IN (?)', $optionIds, \Zend_Db::INT_TYPE); } return $this; } @@ -229,7 +229,7 @@ public function setOptionIdsFilter($optionIds) public function setSelectionIdsFilter($selectionIds) { if (!empty($selectionIds)) { - $this->getSelect()->where('selection.selection_id IN (?)', $selectionIds, \Zend_Db::BIGINT_TYPE); + $this->getSelect()->where('selection.selection_id IN (?)', $selectionIds, \Zend_Db::INT_TYPE); } return $this; } diff --git a/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php b/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php index 76e670721c31d..8025cf91d28c9 100644 --- a/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php +++ b/app/code/Magento/BundleGraphQl/Model/Resolver/Links/Collection.php @@ -108,7 +108,7 @@ private function fetch() : array } $linkCollection->getSelect() - ->where($field . ' IN (?)', $this->parentIds, \Zend_Db::BIGINT_TYPE); + ->where($field . ' IN (?)', $this->parentIds, \Zend_Db::INT_TYPE); /** @var Selection $link */ foreach ($linkCollection as $link) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index f2148a721d764..ae24b60719ca7 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -425,7 +425,7 @@ private function getLinkIds(array $entityIds) )->where( 'e.entity_id IN (?)', $entityIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); return $this->connection->fetchCol($select); @@ -471,11 +471,11 @@ protected function getAttributeTypeValues($type, $entityIds, $storeId) )->where( "e.entity_id IN (?)", $entityIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 'def.store_id IN (?)', [Store::DEFAULT_STORE_ID, $storeId], - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); return $this->connection->fetchAll($select); diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php index c5751d580607b..20f01e4b0a0ab 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php @@ -120,7 +120,7 @@ protected function filterIdsByStore(array $ids, $store) )->where( "entity_id IN (?)", $ids, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $resultIds = []; diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index 2d1990037d9b1..38f606b8abefe 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -508,7 +508,7 @@ protected function createAnchorSelect(Store $store) $this->connection->quoteInto( 'cc2.parent_id = cc.entity_id AND cc.entity_id NOT IN (?)', $rootCatIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ), [] )->joinInner( diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php index f758fd1759309..a7c5cdf412e6e 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php @@ -282,7 +282,7 @@ private function reindexCategoriesBySelect(Select $basicSelect, $whereCondition, $this->connection->delete($this->tableMaintainer->getMainTmpTable((int)$store->getId())); $entityIds = $this->connection->fetchCol($query); $resultSelect = clone $basicSelect; - $resultSelect->where($whereCondition, $entityIds, \Zend_Db::BIGINT_TYPE); + $resultSelect->where($whereCondition, $entityIds, \Zend_Db::INT_TYPE); $this->connection->query( $this->connection->insertFromSelect( $resultSelect, diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php index 3a9c4a94e58e5..edd68422ec4ac 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php @@ -151,7 +151,7 @@ private function getProductIdsWithParents(array $childProductIds): array ->select() ->from(['relation' => $this->getTable('catalog_product_relation')], []) ->distinct(true) - ->where('child_id IN (?)', $childProductIds, \Zend_Db::BIGINT_TYPE) + ->where('child_id IN (?)', $childProductIds, \Zend_Db::INT_TYPE) ->join( ['cpe' => $this->getTable('catalog_product_entity')], 'relation.parent_id = cpe.' . $fieldForParent, @@ -215,7 +215,7 @@ protected function removeEntries() protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getNonAnchorCategoriesSelect($store); - return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE); + return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::INT_TYPE); } /** @@ -227,7 +227,7 @@ protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $stor protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getAnchorCategoriesSelect($store); - return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE); + return $select->where('ccp.product_id IN (?)', $this->limitationByProducts, \Zend_Db::INT_TYPE); } /** @@ -239,7 +239,7 @@ protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) protected function getAllProducts(\Magento\Store\Model\Store $store) { $select = parent::getAllProducts($store); - return $select->where('cp.entity_id IN (?)', $this->limitationByProducts, \Zend_Db::BIGINT_TYPE); + return $select->where('cp.entity_id IN (?)', $this->limitationByProducts, \Zend_Db::INT_TYPE); } /** @@ -265,7 +265,7 @@ private function getCategoryIdsFromIndex(array $productIds): array $storeCategories = $this->connection->fetchCol( $this->connection->select() ->from($this->getIndexTable($store->getId()), ['category_id']) - ->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) + ->where('product_id IN (?)', $productIds, \Zend_Db::INT_TYPE) ->distinct() ); $categoryIds[] = $storeCategories; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index 584eea02241db..99d75186eca8c 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -354,7 +354,7 @@ protected function _updateTemporaryTableByStoreValues( ); if (!empty($changedIds)) { $select->where( - $this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + $this->_connection->quoteInto('et.entity_id IN (?)', $changedIds, \Zend_Db::INT_TYPE) ); } $sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]); @@ -382,7 +382,7 @@ protected function _updateTemporaryTableByStoreValues( $this->_connection->quoteInto( 'et.entity_id IN (?)', $changedIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ) ); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php index d99217b44593d..c14ea4bc363f8 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php @@ -348,7 +348,7 @@ protected function _fillTemporaryTable( if (!empty($changedIds)) { $select->where( - $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::INT_TYPE) ); } @@ -358,7 +358,7 @@ protected function _fillTemporaryTable( if (count($valueColumns) > 1) { if (!empty($changedIds)) { $selectValue->where( - $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE) + $this->_connection->quoteInto('e.entity_id IN (?)', $changedIds, \Zend_Db::INT_TYPE) ); } $sql = $selectValue->insertFromSelect($temporaryValueTableName, $valueColumns, true); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php index 406455fef13dc..f3a4b322e29df 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php @@ -436,7 +436,7 @@ private function deleteIndexData(array $entityIds) $select = $this->getConnection()->select()->from( ['index_price' => $this->tableMaintainer->getMainTableByDimensions($dimensions)], null - )->where('index_price.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); + )->where('index_price.entity_id IN (?)', $entityIds, \Zend_Db::INT_TYPE); $query = $select->deleteFromSelect('index_price'); $this->getConnection()->query($query); } @@ -547,7 +547,7 @@ private function getProductsTypes(array $changedIds = []) ['entity_id', 'type_id'] ); if ($changedIds) { - $select->where('entity_id IN (?)', $changedIds, \Zend_Db::BIGINT_TYPE); + $select->where('entity_id IN (?)', $changedIds, \Zend_Db::INT_TYPE); } $pairs = $this->getConnection()->fetchPairs($select); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php b/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php index de9d60b77033a..b8da7452b09ce 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/AttributeSetFinder.php @@ -37,7 +37,7 @@ public function findAttributeSetIdsByProductIds(array $productIds) ->getSelect() ->reset(Select::COLUMNS) ->columns(ProductInterface::ATTRIBUTE_SET_ID) - ->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) + ->where('entity_id IN (?)', $productIds, \Zend_Db::INT_TYPE) ->group(ProductInterface::ATTRIBUTE_SET_ID); $result = $collection->getConnection()->fetchCol($select); return $result; diff --git a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php index 99c66bd9f5be1..ecab88c9c7e03 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php +++ b/app/code/Magento/Catalog/Model/Product/Price/PricePersistence.php @@ -105,7 +105,7 @@ public function get(array $skus) ->select() ->from($this->attributeResource->getTable($this->table)); return $this->attributeResource->getConnection()->fetchAll( - $select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::BIGINT_TYPE) + $select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::INT_TYPE) ->where('attribute_id = ?', $this->getAttributeId()) ); } @@ -214,13 +214,13 @@ private function getAttributeId() */ private function retrieveAffectedIds(array $skus) { - $affectedIds = [[]]; + $affectedIds = []; foreach ($this->productIdLocator->retrieveProductIdsBySkus($skus) as $productIds) { $affectedIds[] = array_keys($productIds); } - return array_unique(array_merge(...$affectedIds)); + return array_unique(array_merge([], ...$affectedIds)); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php b/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php index 1088fa7417444..65b1aec3b4817 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php +++ b/app/code/Magento/Catalog/Model/Product/Price/TierPricePersistence.php @@ -56,7 +56,7 @@ public function get(array $ids) { $select = $this->tierpriceResource->getConnection()->select()->from($this->tierpriceResource->getMainTable()); return $this->tierpriceResource->getConnection()->fetchAll( - $select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::BIGINT_TYPE) + $select->where($this->getEntityLinkField() . ' IN (?)', $ids, \Zend_Db::INT_TYPE) ); } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php index cf0e82046f3a5..c71225b4fc67f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php @@ -147,7 +147,7 @@ protected function _getLoadAttributesSelect($object, $table) ->select() ->from(['attr_table' => $table], []) ->where("attr_table.{$this->getLinkField()} = ?", $object->getData($this->getLinkField())) - ->where('attr_table.store_id IN (?)', $storeIds, \Zend_Db::BIGINT_TYPE); + ->where('attr_table.store_id IN (?)', $storeIds, \Zend_Db::INT_TYPE); if ($setId) { $select->join( @@ -565,7 +565,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) $connection->quoteInto( 'default_value.attribute_id IN (?)', array_keys($_attributes), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ), "default_value.{$this->getLinkField()} = e.{$this->getLinkField()}", 'default_value.store_id = 0', @@ -596,7 +596,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) $connection->quoteInto( 'store_value.attribute_id IN (?)', array_keys($_attributes), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ), "store_value.{$this->getLinkField()} = e.{$this->getLinkField()}", 'store_value.store_id = :store_id', diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index a9c771c03e34f..917aafb643b47 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -667,7 +667,7 @@ public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValu )->where( 'ce.entity_id IN (?)', $entityIdsFilter, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $this->entitiesWhereAttributesIs[$entityIdsFilterHash][$attribute->getId()][$expectedValue] = $this->getConnection()->fetchCol($selectEntities, $bind); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php index dccfa03ec5d49..759866de4b49d 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php @@ -294,7 +294,7 @@ protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId $inactiveCategories = $this->getInactiveCategoryIds(); if (!empty($inactiveCategories)) { - $select->where('main_table.entity_id NOT IN (?)', $inactiveCategories, \Zend_Db::BIGINT_TYPE); + $select->where('main_table.entity_id NOT IN (?)', $inactiveCategories, \Zend_Db::INT_TYPE); } // Allow extensions to modify select (e.g. add custom category attributes to select) @@ -682,7 +682,7 @@ public function getAnchorsAbove(array $filterIds, $storeId = 0) )->where( 'entity_id IN (?)', $filterIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); return $this->getConnection()->fetchCol($select); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php b/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php index 490406d7f68f5..02fdb8270791d 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php @@ -171,11 +171,11 @@ protected function _getLoadAttributesSelect($table, $attributeIds = []) )->where( "e.entity_id IN (?)", array_keys($this->_itemsById), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 't_d.attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->joinLeft( ['t_s' => $table], implode(' AND ', $joinCondition), @@ -195,11 +195,11 @@ protected function _getLoadAttributesSelect($table, $attributeIds = []) )->where( "e.entity_id IN (?)", array_keys($this->_itemsById), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 'attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 'store_id = ?', $this->getDefaultStoreId() diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product.php b/app/code/Magento/Catalog/Model/ResourceModel/Product.php index fc50b78338333..b174e4beb6353 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product.php @@ -236,7 +236,7 @@ public function getWebsiteIdsByProductIds($productIds) )->where( 'product_id IN (?)', $productIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $productsWebsites = []; foreach ($this->getConnection()->fetchAll($select) as $productInfo) { @@ -361,7 +361,7 @@ private function deleteSelectedEntityAttributeRows(DataObject $product, array $a $entityId = $product->getData($entityIdField); foreach ($backendTables as $backendTable => $attributes) { $connection = $this->getConnection(); - $where = $connection->quoteInto('attribute_id IN (?)', $attributes, \Zend_Db::BIGINT_TYPE); + $where = $connection->quoteInto('attribute_id IN (?)', $attributes, \Zend_Db::INT_TYPE); $where .= $connection->quoteInto(" AND {$entityIdField} = ?", $entityId); $connection->delete($backendTable, $where); } @@ -454,6 +454,7 @@ public function getAvailableInCategories($object) // fetching all parent IDs, including those are higher on the tree $entityId = (int)$object->getEntityId(); if (!isset($this->availableCategoryIdsCache[$entityId])) { + $unionTables = []; foreach ($this->_storeManager->getStores() as $store) { $unionTables[] = $this->getAvailableInCategoriesSelect( $entityId, @@ -599,7 +600,7 @@ public function getProductsSku(array $productIds) )->where( 'entity_id IN (?)', $productIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); return $this->getConnection()->fetchAll($select); } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index 231176b3f2447..7dbfe0d5fccea 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -859,7 +859,7 @@ protected function doAddWebsiteNamesToResult() )->where( 'product_website.product_id IN (?)', array_keys($productWebsites), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 'website.website_id > ?', 0 @@ -1359,7 +1359,7 @@ public function addCountToCategories($categoryCollection) $anchorStmt = clone $select; $anchorStmt->limit(); //reset limits - $anchorStmt->where('count_table.category_id IN (?)', $isAnchor, \Zend_Db::BIGINT_TYPE); + $anchorStmt->where('count_table.category_id IN (?)', $isAnchor, \Zend_Db::INT_TYPE); $productCounts += $this->getConnection()->fetchPairs($anchorStmt); $anchorStmt = null; } @@ -1367,7 +1367,7 @@ public function addCountToCategories($categoryCollection) $notAnchorStmt = clone $select; $notAnchorStmt->limit(); //reset limits - $notAnchorStmt->where('count_table.category_id IN (?)', $isNotAnchor, \Zend_Db::BIGINT_TYPE); + $notAnchorStmt->where('count_table.category_id IN (?)', $isNotAnchor, \Zend_Db::INT_TYPE); $notAnchorStmt->where('count_table.is_parent = 1'); $productCounts += $this->getConnection()->fetchPairs($notAnchorStmt); $notAnchorStmt = null; @@ -2166,7 +2166,7 @@ public function addCategoryIds() $select = $this->getConnection()->select(); $select->from($this->_productCategoryTable, ['product_id', 'category_id']); - $select->where('product_id IN (?)', $ids, \Zend_Db::BIGINT_TYPE); + $select->where('product_id IN (?)', $ids, \Zend_Db::INT_TYPE); $data = $this->getConnection()->fetchAll($select); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php index b3caeb80b2da7..ef274b1bef55e 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php @@ -488,7 +488,7 @@ public function getProductImages($product, $storeIds) )->where( 'store_id IN (?)', $storeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 'attribute_code IN (?)', ['small_image', 'thumbnail', 'image'] diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php index 78f0f69541d71..578e3099a2fde 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php @@ -775,7 +775,7 @@ protected function _movePriceDataToIndexTable($entityIds = null) $select = $connection->select()->from($table, $columns); if ($entityIds !== null) { - $select->where('entity_id in (?)', count($entityIds) > 0 ? $entityIds : 0, \Zend_Db::BIGINT_TYPE); + $select->where('entity_id in (?)', count($entityIds) > 0 ? $entityIds : 0, \Zend_Db::INT_TYPE); } $query = $select->insertFromSelect($this->getIdxTable(), [], false); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php index 602c2c781443e..aa66978fa0036 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/TierPrice.php @@ -193,7 +193,7 @@ private function getTierPriceSelect(bool $isAllWebsites, bool $isAllCustomerGrou [] ); if (!empty($entityIds)) { - $select->where('entity.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); + $select->where('entity.entity_id IN (?)', $entityIds, \Zend_Db::INT_TYPE); } $this->joinWebsites($select, $isAllWebsites); $this->joinCustomerGroups($select, $isAllCustomerGroups); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 81569fb581273..bca919e700364 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -212,7 +212,7 @@ public function setIsStrongMode() /** * Retrieve collection link model * - * @return LinkModel + * @return \Magento\Catalog\Model\Product\Link */ public function getLinkModel() { @@ -262,7 +262,7 @@ public function addExcludeProductFilter($products) $this->getSelect()->where( 'links.linked_product_id NOT IN (?)', $products, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); } return $this; @@ -284,7 +284,7 @@ public function addProductFilter($products) $this->getSelect()->where( "product_entity_table.$identifierField IN (?)", $products, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $this->_hasLinkFilter = true; } @@ -350,14 +350,14 @@ protected function _joinLinks() $this->getSelect()->where( 'links.product_id in (?)', $this->productIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); } else { $joinType = 'joinLeft'; $joinCondition[] = $connection->quoteInto( 'links.product_id in (?)', $this->productIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); } if (count($this->productIds) === 1) { diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php index dc5efb83c86c7..eee5106579255 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Website.php @@ -126,7 +126,7 @@ public function getWebsites($productIds) )->where( 'product_id IN (?)', $productIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $rowset = $this->getConnection()->fetchAll($select); diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php b/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php index 514cd2e3e88c5..2ad7ca9f14963 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php @@ -105,7 +105,7 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds = } if (!empty($entityIds)) { - $select->where('stock_item.product_id in (?)', $entityIds, \Zend_Db::BIGINT_TYPE); + $select->where('stock_item.product_id in (?)', $entityIds, \Zend_Db::INT_TYPE); } $select->group('stock_item.product_id'); diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php index e38ff58dfe1f6..f1cef90fc68ca 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/CacheCleaner.php @@ -118,7 +118,7 @@ private function getProductStockStatuses(array $productIds) 'cpr.parent_id = cpe.' . $linkField, ['parent_id' => 'cpe.entity_id'] ) - ->where('product_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) + ->where('product_id IN (?)', $productIds, \Zend_Db::INT_TYPE) ->where('stock_id = ?', Stock::DEFAULT_STOCK_ID) ->where('website_id = ?', $this->stockConfiguration->getDefaultScopeId()); diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php index c818fb029367d..f994bb8fe26a1 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock.php @@ -138,18 +138,18 @@ public function lockProductsStock(array $productIds, $websiteId) $itemIds = []; $preSelect = $this->getConnection()->select()->from($itemTable, 'item_id') ->where('website_id = ?', $websiteId) - ->where('product_id IN(?)', $productIds, \Zend_Db::BIGINT_TYPE); + ->where('product_id IN(?)', $productIds, \Zend_Db::INT_TYPE); foreach ($this->getConnection()->query($preSelect)->fetchAll() as $item) { $itemIds[] = (int)$item['item_id']; } $select = $this->getConnection()->select()->from(['si' => $itemTable]) - ->where('item_id IN (?)', $itemIds, \Zend_Db::BIGINT_TYPE) + ->where('item_id IN (?)', $itemIds, \Zend_Db::INT_TYPE) ->forUpdate(true); $productTable = $this->getTable('catalog_product_entity'); $selectProducts = $this->getConnection()->select()->from(['p' => $productTable], []) - ->where('entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE) + ->where('entity_id IN (?)', $productIds, \Zend_Db::INT_TYPE) ->columns( [ 'product_id' => 'entity_id', diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php index f98ff1c764acd..02e443d09b228 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status.php @@ -340,7 +340,7 @@ public function getProductStatus($productIds, $storeId = null) if ($storeId === null || $storeId == Store::DEFAULT_STORE_ID) { $select = $connection->select()->from($attributeTable, [$linkField, 'value']) - ->where("{$linkField} IN (?)", $productIds, \Zend_Db::BIGINT_TYPE) + ->where("{$linkField} IN (?)", $productIds, \Zend_Db::INT_TYPE) ->where('attribute_id = ?', $attribute->getAttributeId()) ->where('store_id = ?', Store::DEFAULT_STORE_ID); diff --git a/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php b/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php index 7f64573587ca0..90e50538bcba3 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/ProductPriceIndexModifier.php @@ -71,7 +71,7 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds = [] ); if ($entityIds) { - $select->where('i.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); + $select->where('i.entity_id IN (?)', $entityIds, \Zend_Db::INT_TYPE); } $finalPrice = $priceTable->getFinalPriceField(); diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php index 2233c6e60ae08..1ef0490092b40 100644 --- a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php +++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/ConfigurableProductsProvider.php @@ -42,7 +42,7 @@ public function getIds(array $ids) ->select() ->from(['e' => $this->resource->getTableName('catalog_product_entity')], ['e.entity_id']) ->where('e.type_id = ?', \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) - ->where('e.entity_id IN (?)', $ids, \Zend_Db::BIGINT_TYPE) + ->where('e.entity_id IN (?)', $ids, \Zend_Db::INT_TYPE) ); } return $this->productIds[$key]; diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php index 00b689ff1eb89..8c4690f044764 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php @@ -242,7 +242,7 @@ private function getSelectForSearchableProducts( $this->joinAttribute($select, 'status', $storeId, [Status::STATUS_ENABLED]); if ($productIds !== null) { - $select->where('e.entity_id IN (?)', $productIds, \Zend_Db::BIGINT_TYPE); + $select->where('e.entity_id IN (?)', $productIds, \Zend_Db::INT_TYPE); } $select->where('e.entity_id > ?', $lastProductId); $select->order('e.entity_id'); @@ -411,7 +411,7 @@ public function getProductAttributes($storeId, array $productIds, array $attribu )->where( 'cpe.entity_id IN (?)', $productIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ) ); foreach ($attributeTypes as $backendType => $attributeIds) { diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php index b8d3fcf90580d..3ce8a96fb5070 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php @@ -317,7 +317,7 @@ protected function getProductIdsFromParents(array $entityIds) ->select() ->from(['relation' => $this->getTable('catalog_product_relation')], []) ->distinct(true) - ->where('child_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE) + ->where('child_id IN (?)', $entityIds, \Zend_Db::INT_TYPE) ->join( ['cpe' => $this->getTable('catalog_product_entity')], 'relation.parent_id = cpe.' . $linkField, diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php index 4617b27435cda..ad6d37c296012 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext.php @@ -117,7 +117,7 @@ public function getRelationsByChild($childIds) )->where( 'relation.child_id IN (?)', $childIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); return $connection->fetchCol($select); diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php index df4f834006e80..d37f0f8a5153b 100644 --- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Search/Collection.php @@ -259,7 +259,7 @@ protected function _getSearchEntityIdsSql($query, $searchOnlyInCurrentStore = tr )->where( 't1.attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 't1.store_id = ?', 0 @@ -334,7 +334,7 @@ protected function _getSearchInOptionSql($query) )->where( 'o.attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( $this->_resourceHelper->getCILike($ifValue, $this->_searchQuery, ['position' => 'any']) ); diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index 51fed8ed6deb1..6031ab6f8f8ae 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -221,7 +221,7 @@ private function fillTemporaryOptionsTable(string $temporaryOptionsTableName, ar ['le.entity_id', 'customer_group_id', 'website_id'] ); if ($entityIds !== null) { - $select->where('le.entity_id IN (?)', $entityIds, \Zend_Db::BIGINT_TYPE); + $select->where('le.entity_id IN (?)', $entityIds, \Zend_Db::INT_TYPE); } $this->tableMaintainer->insertFromSelect($select, $temporaryOptionsTableName, []); } diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php index 0abfd953e3435..9d779d9704c29 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable.php @@ -174,7 +174,7 @@ public function getChildrenIds($parentId, $required = true) )->where( 'p.entity_id IN (?)', $parentId, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $childrenIds = [ diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php index f699eae23e359..e4b9acbde3030 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Attribute/Collection.php @@ -287,7 +287,7 @@ protected function _loadLabels() )->where( 'def.product_super_attribute_id IN (?)', array_keys($this->_items), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 'def.store_id = ?', 0 diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php index 9acb5c1f78647..cefd4b815d729 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Type/Configurable/Product/Collection.php @@ -85,7 +85,7 @@ protected function _renderFilters() $parentIds[] = $product->getData($metadata->getLinkField()); } - $this->getSelect()->where('link_table.parent_id in (?)', $parentIds, \Zend_Db::BIGINT_TYPE); + $this->getSelect()->where('link_table.parent_id in (?)', $parentIds, \Zend_Db::INT_TYPE); return $this; } diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index fc3a7676ee5ed..b29d45f75c993 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -679,6 +679,9 @@ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinTy throw new LocalizedException(__('The foreign key is invalid. Verify the foreign key and try again.')); } + $entity = null; + $attrArr = []; + // try to explode combined entity/attribute if supplied if (is_string($attribute)) { $attrArr = explode('/', $attribute); @@ -1121,12 +1124,13 @@ public function _loadEntities($printQuery = false, $logQuery = false) $this->printLogQuery($printQuery, $logQuery); + /** + * Prepare select query + * @var string|\Magento\Framework\DB\Select $query + */ + $query = $this->getSelect(); + try { - /** - * Prepare select query - * @var string $query - */ - $query = $this->getSelect(); $rows = $this->_fetchAll($query); } catch (\Exception $e) { $this->printLogQuery(false, true, $query); @@ -1192,12 +1196,12 @@ public function _loadAttributes($printQuery = false, $logQuery = false) $selectGroups = $this->_resourceHelper->getLoadAttributesSelectGroups($selects); foreach ($selectGroups as $selects) { if (!empty($selects)) { + if (is_array($selects)) { + $select = implode(' UNION ALL ', $selects); + } else { + $select = $selects; + } try { - if (is_array($selects)) { - $select = implode(' UNION ALL ', $selects); - } else { - $select = $selects; - } $values = $this->getConnection()->fetchAll($select); } catch (\Exception $e) { $this->printLogQuery(true, true, $select); @@ -1239,11 +1243,11 @@ protected function _getLoadAttributesSelect($table, $attributeIds = []) )->where( " e.entity_id IN (?)", array_keys($this->_itemsById), - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE )->where( 't_d.attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); if ($entity->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE && $entity->getTypeId()) { diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php index c3569fa3f75f8..29cad62bf0ca4 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php @@ -779,7 +779,7 @@ public function getValidAttributeIds($attributeIds) )->where( 'attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); return $connection->fetchCol($select); diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php index b354d8682e2d1..bcd8f2bb04e69 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php @@ -233,7 +233,7 @@ public function setInAllAttributeSetsFilter(array $setIds) ->where( 'entity_attribute.attribute_set_id IN (?)', $setIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ) ->group('entity_attribute.attribute_id') ->having(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds)); @@ -407,7 +407,7 @@ protected function _addSetInfo() )->where( 'attribute_id IN (?)', $attributeIds, - \Zend_Db::BIGINT_TYPE + \Zend_Db::INT_TYPE ); $result = $connection->fetchAll($select); @@ -439,7 +439,7 @@ protected function _addSetInfo() /** * Ad information about attribute sets to collection result data * - * @return $this + * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection */ protected function _afterLoadData() { diff --git a/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php b/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php index b831336493958..e8c8d4c5190fe 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php +++ b/app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php @@ -152,7 +152,7 @@ public function execute($entityType, $entityData, $arguments = []) ['value' => 't.value', 'attribute_id' => 't.attribute_id'] ) ->where($metadata->getLinkField() . ' = ?', $entityData[$metadata->getLinkField()]) - ->where('attribute_id IN (?)', $attributeIds, \Zend_Db::BIGINT_TYPE); + ->where('attribute_id IN (?)', $attributeIds, \Zend_Db::INT_TYPE); $attributeIdentifiers = []; foreach ($context as $scope) { //TODO: if (in table exists context field) From 8e6cb1358750eb5222a5336ed8233949ae20bfab Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Sat, 22 Aug 2020 21:19:24 +0300 Subject: [PATCH 26/33] Added StorefrontClickAddToCartButtonActionGroup --- ...rontGoToDetailsPageWhenAddingToCartTest.xml | 3 +-- ...orefrontClickAddToCartButtonActionGroup.xml | 18 ++++++++++++++++++ ...rUKCustomerRemainOptionAfterRefreshTest.xml | 2 +- ...eldShouldNotAcceptJustIntegerValuesTest.xml | 2 +- ...ckoutForProductsDeletedFromMiniCartTest.xml | 2 +- ...estWithMultipleAddressesAndTaxRatesTest.xml | 4 ++-- ...stWithRestrictedCountriesForPaymentTest.xml | 2 +- .../StorefrontGuestCheckoutTest.xml | 2 +- ...stWithRestrictedCountriesForPaymentTest.xml | 2 +- ...rontVerifySecureURLRedirectCheckoutTest.xml | 3 +-- ...refrontConfigurableProductAddToCartTest.xml | 3 +-- ...erifySecureURLRedirectMultishippingTest.xml | 3 +-- .../Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 +- ...reditMemoTotalAfterShippingDiscountTest.xml | 2 +- 14 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartButtonActionGroup.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml index f6866f813f258..88fc5b7171592 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml @@ -71,8 +71,7 @@ <!--Click add to cart--> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addProductToCart"/> - <waitForPageLoad stepKey="waitForProductPage"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addProductToCart"/> <!--Check for details page--> <seeInCurrentUrl url="{{BundleProduct.sku}}" stepKey="seeBundleProductDetailsPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartButtonActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartButtonActionGroup.xml new file mode 100644 index 0000000000000..3d240a21afc28 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontClickAddToCartButtonActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontClickAddToCartButtonActionGroup"> + <annotations> + <description>Click "Add to Cart" button.</description> + </annotations> + <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <waitForPageLoad stepKey="waitAddToCart"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest.xml index 7eae5d0d292d1..e7e8f9f0ef699 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldForUKCustomerRemainOptionAfterRefreshTest.xml @@ -35,7 +35,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml index 12e1a6e9872d3..7c4b18e1aab89 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/AddressStateFieldShouldNotAcceptJustIntegerValuesTest.xml @@ -38,7 +38,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml index 313f5997e0af0..bf942e70cfa36 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml @@ -40,7 +40,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addProductToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addProductToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createSimpleProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithMultipleAddressesAndTaxRatesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithMultipleAddressesAndTaxRatesTest.xml index 92150b1e99dd5..9747980801068 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithMultipleAddressesAndTaxRatesTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithMultipleAddressesAndTaxRatesTest.xml @@ -83,7 +83,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$simplecategory.name$$)}}" stepKey="onCategoryPage1"/> <waitForPageLoad stepKey="waitForCatalogPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct1"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart1"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart1"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded1"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$simpleproduct1.name$$ to your shopping cart." stepKey="seeAddedToCartMessage1"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity1"/> @@ -102,7 +102,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$simplecategory.name$$)}}" stepKey="onCategoryPage2"/> <waitForPageLoad stepKey="waitForCatalogPageLoad2"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct2"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart2"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart2"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded2"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$simpleproduct1.name$$ to your shopping cart." stepKey="seeAddedToCartMessage2"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity2"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithRestrictedCountriesForPaymentTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithRestrictedCountriesForPaymentTest.xml index 732038f24834b..d6f1408c2b66a 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithRestrictedCountriesForPaymentTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithRestrictedCountriesForPaymentTest.xml @@ -52,7 +52,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTest.xml index be5cf143f13dc..b591aefbdc889 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTest.xml @@ -40,7 +40,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTestWithRestrictedCountriesForPaymentTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTestWithRestrictedCountriesForPaymentTest.xml index 7660df18407d5..15b550657ef60 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTestWithRestrictedCountriesForPaymentTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTestWithRestrictedCountriesForPaymentTest.xml @@ -43,7 +43,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVerifySecureURLRedirectCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVerifySecureURLRedirectCheckoutTest.xml index b7c1d7b83e9b7..03323b7b9c855 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVerifySecureURLRedirectCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVerifySecureURLRedirectCheckoutTest.xml @@ -28,8 +28,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="goToCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="clickAddToCartButton"/> - <waitForPageLoad stepKey="waitForAddToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="clickAddToCartButton"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForAddedToCartSuccessMessage"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$product.name$$ to your shopping cart." stepKey="seeAddedToCartSuccessMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml index 2ca8bbc9feb9d..238f1e107c11b 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml @@ -39,8 +39,7 @@ <waitForPageLoad stepKey="wait1"/> <click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="clickListView"/> <waitForPageLoad stepKey="wait2"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="clickAddToCart"/> - <waitForPageLoad stepKey="wait3"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="clickAddToCart"/> <grabFromCurrentUrl stepKey="grabUrl"/> <assertStringContainsString stepKey="assertUrl"> <expectedResult type="string">{{_defaultProduct.urlKey}}</expectedResult> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontVerifySecureURLRedirectMultishippingTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontVerifySecureURLRedirectMultishippingTest.xml index 494259e0ead9d..fe33078755ac4 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontVerifySecureURLRedirectMultishippingTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontVerifySecureURLRedirectMultishippingTest.xml @@ -33,8 +33,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$category.name$$)}}" stepKey="goToCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="moveMouseOverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="clickAddToCartButton"/> - <waitForPageLoad stepKey="waitForAddToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="clickAddToCartButton"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForAddedToCartSuccessMessage"/> <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$product.name$$ to your shopping cart." stepKey="seeAddedToCartSuccessMessage"/> <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 627f739852ee7..30f8386b3bb91 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -34,7 +34,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickCart"/> <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml index 7444de8271ed9..e41e3acbae380 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml @@ -64,7 +64,7 @@ <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverOverProduct"/> - <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/> + <actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductToAdd"/> <actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="clickCart"/> <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> From 6e7914f27687a514b19257e5a3f7a6d4c01699ff Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Sat, 22 Aug 2020 21:34:30 +0300 Subject: [PATCH 27/33] V2 use AdminOpenCreateNewCMSPageActionGroup --- .../ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml | 4 ++++ .../Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml | 3 +-- .../Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml | 3 +-- .../Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml | 3 +-- .../AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml | 3 +-- ...minAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml | 3 +-- ...dminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml | 3 +-- ...dminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml | 3 +-- ...dWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml | 3 +-- ...AddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml | 3 +-- ...nfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml | 3 +-- .../Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml | 6 ++---- 12 files changed, 16 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml index 79ce1bc9d8e47..4e19329e9b899 100644 --- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml +++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCreateNewCMSPageActionGroup.xml @@ -8,6 +8,10 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminOpenCreateNewCMSPageActionGroup"> + <annotations> + <description>Open create new CMS Page.</description> + </annotations> + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToCreateNewPage"/> <waitForPageLoad stepKey="waitForNewPagePageLoad"/> </actionGroup> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml index 9163ec4d9f5f8..35d8e692cd460 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml @@ -37,8 +37,7 @@ <magentoCLI command="config:set cms/wysiwyg/editor mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter" stepKey="enableTinyMCE4"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage2"/> - <waitForPageLoad stepKey="wait5"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage2"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle2"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab2" /> <comment userInput="removing deprecated element" stepKey="waitForTinyMCE3"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml index 55c01f3818a19..698f29a28598f 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml @@ -31,8 +31,7 @@ <fillField selector="{{StoreConfigSection.City}}" userInput="{{_defaultVariable.city}}" stepKey="fillCity" /> <click selector="{{StoreConfigSection.Save}}" stepKey="saveConfig"/> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="waitForPageLoad2"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml index 450003db465a8..509e1abe81ef6 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml @@ -24,8 +24,7 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml index 633dd4dbc3388..cfb323683dc2c 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml @@ -25,8 +25,7 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml index 14bdc89cec311..d9ea67491e30a 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml @@ -25,8 +25,7 @@ <actionGroup ref="ConfigAdminAccountSharingActionGroup" stepKey="allowAdminShareAccount"/> </before> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml index 2b788bc6ca0fd..86f90e0e2a580 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml @@ -28,8 +28,7 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml index 2124206466c2d..dcb4c3dc11f3c 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml @@ -30,8 +30,7 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml index 85ae0380d4b43..6acf8ef18a332 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml @@ -28,8 +28,7 @@ <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml index 14182a4c33549..1ec4f7054e8c2 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml @@ -28,8 +28,7 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <!--Main test--> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage"/> - <waitForPageLoad stepKey="wait1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml index 0eac31c891e64..88e81d6e8fbbf 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml @@ -34,8 +34,7 @@ <seeOptionIsSelected selector="{{DefaultLayoutsSection.categoryLayout}}" userInput="No layout updates" stepKey="seeNoLayoutUpdatesSelected2" /> <selectOption selector="{{DefaultLayoutsSection.pageLayout}}" userInput="2 columns with right bar" stepKey="selectColumnsWithRightBar"/> <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig" /> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="amOnPagePagesGrid"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="amOnPagePagesGrid"/> <waitForLoadingMaskToDisappear stepKey="wait2" /> <click selector="{{CmsDesignSection.DesignTab}}" stepKey="clickOnDesignTab"/> <waitForElementVisible selector="{{CmsDesignSection.LayoutDropdown}}" stepKey="waitForLayoutDropDown" /> diff --git a/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml b/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml index 01b2101d3346c..ddb6c4071a0e7 100644 --- a/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml +++ b/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml @@ -34,8 +34,7 @@ <selectOption selector="{{ContentManagementSection.Switcher}}" userInput="TinyMCE 4" stepKey="switchToVersion4" /> <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions1" /> <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig1" /> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage1"/> - <waitForPageLoad stepKey="wait2"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage1"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle1"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab1" /> <waitForElementVisible selector="{{TinyMCESection.TinyMCE4}}" stepKey="waitForTinyMCE4"/> @@ -62,8 +61,7 @@ <selectOption selector="{{ContentManagementSection.Switcher}}" userInput="TinyMCE 3" stepKey="switchToVersion3" /> <click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptions2" /> <click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig2" /> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage2"/> - <waitForPageLoad stepKey="wait5"/> + <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToPage2"/> <fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{_defaultCmsPage.title}}" stepKey="fillFieldTitle2"/> <click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab2" /> <comment userInput="removing deprecated element" stepKey="waitForTinyMCE3"/> From ef7b93bf713b32649b9059d4745d88ded81ba5c9 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Sun, 23 Aug 2020 21:39:51 +0300 Subject: [PATCH 28/33] v6 add AdminOpenGeneralConfigurationPageActionGroup --- ...penGeneralConfigurationPageActionGroup.xml | 19 +++++++++++++++++++ ...ceForDifferentTimezonesForWebsitesTest.xml | 12 ++++-------- ...inCreateCartPriceRuleEmptyFromDateTest.xml | 6 ++---- 3 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenGeneralConfigurationPageActionGroup.xml diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenGeneralConfigurationPageActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenGeneralConfigurationPageActionGroup.xml new file mode 100644 index 0000000000000..ecacf063938ad --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenGeneralConfigurationPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenGeneralConfigurationPageActionGroup"> + <annotations> + <description>Open general configuration page.</description> + </annotations> + + <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="openGeneralConfigurationPage"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml index 0dccc409a1032..164701fa5bc6d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml @@ -37,16 +37,14 @@ </after> <!--Set timezone for default config--> - <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfig"/> - <waitForPageLoad stepKey="waitForConfigPage"/> + <actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfig"/> <conditionalClick selector="{{LocaleOptionsSection.sectionHeader}}" dependentSelector="{{LocaleOptionsSection.timezone}}" visible="false" stepKey="openLocaleSection"/> <grabValueFrom selector="{{LocaleOptionsSection.timezone}}" stepKey="originalTimezone"/> <selectOption selector="{{LocaleOptionsSection.timezone}}" userInput="Central European Standard Time (Europe/Paris)" stepKey="setTimezone"/> <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfig"/> <!--Set timezone for Main Website--> - <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfig1"/> - <waitForPageLoad stepKey="waitForConfigPage1"/> + <actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfig1"/> <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreViewActionGroup"> <argument name="website" value="_defaultWebsite"/> </actionGroup> @@ -80,15 +78,13 @@ </assertEquals> <!--Reset timezone--> - <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfigReset"/> - <waitForPageLoad stepKey="waitForConfigPageReset"/> + <actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfigReset"/> <conditionalClick selector="{{LocaleOptionsSection.sectionHeader}}" dependentSelector="{{LocaleOptionsSection.timezone}}" visible="false" stepKey="openLocaleSectionReset"/> <selectOption selector="{{LocaleOptionsSection.timezone}}" userInput="$originalTimezone" stepKey="resetTimezone"/> <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfigReset"/> <!--Reset timezone--> - <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfigReset1"/> - <waitForPageLoad stepKey="waitForConfigPageReset1"/> + <actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfigReset1"/> <actionGroup ref="AdminSwitchWebsiteActionGroup" stepKey="AdminSwitchStoreViewActionGroup1"> <argument name="website" value="_defaultWebsite"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml index f32442ca5bc98..f956d036d7080 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml @@ -39,8 +39,7 @@ <!--Set timezone--> <!--Set timezone so we need compare with the same timezone used in "generateDate" action--> - <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfig"/> - <waitForPageLoad stepKey="waitForConfigPage"/> + <actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfig"/> <wait stepKey="wait" time="10"/> <conditionalClick selector="{{LocaleOptionsSection.sectionHeader}}" dependentSelector="{{LocaleOptionsSection.timezone}}" visible="false" stepKey="openLocaleSection"/> <grabValueFrom selector="{{LocaleOptionsSection.timezone}}" stepKey="originalTimezone"/> @@ -93,8 +92,7 @@ <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$5.00" stepKey="seeDiscountTotal"/> <!--Reset timezone--> - <amOnPage url="{{GeneralConfigurationPage.url}}" stepKey="goToGeneralConfigReset"/> - <waitForPageLoad stepKey="waitForConfigPageReset"/> + <actionGroup ref="AdminOpenGeneralConfigurationPageActionGroup" stepKey="goToGeneralConfigReset"/> <conditionalClick selector="{{LocaleOptionsSection.sectionHeader}}" dependentSelector="{{LocaleOptionsSection.timezone}}" visible="false" stepKey="openLocaleSectionReset"/> <selectOption selector="{{LocaleOptionsSection.timezone}}" userInput="$originalTimezone" stepKey="resetTimezone"/> <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfigReset"/> From 66184fd823e58a166cd259f7c4da6705f8412d09 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Sun, 23 Aug 2020 21:51:15 +0300 Subject: [PATCH 29/33] V7 add AdminOpenWebConfigurationPageActionGroup --- ...minOpenWebConfigurationPageActionGroup.xml | 19 +++++++++++++++++++ ...goryLayoutFromConfigurationSettingTest.xml | 3 +-- ...ductLayoutFromConfigurationSettingTest.xml | 3 +-- ...PageLayoutFromConfigurationSettingTest.xml | 3 +-- 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenWebConfigurationPageActionGroup.xml diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenWebConfigurationPageActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenWebConfigurationPageActionGroup.xml new file mode 100644 index 0000000000000..e640eda7d653d --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminOpenWebConfigurationPageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenWebConfigurationPageActionGroup"> + <annotations> + <description>Open web configuration page.</description> + </annotations> + + <amOnPage url="{{WebConfigurationPage.url}}" stepKey="openWebConfigurationPage"/> + <waitForPageLoad stepKey="waitPageToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest/AdminConfigDefaultCategoryLayoutFromConfigurationSettingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest/AdminConfigDefaultCategoryLayoutFromConfigurationSettingTest.xml index 900b3f6cd2f1c..852353300d090 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest/AdminConfigDefaultCategoryLayoutFromConfigurationSettingTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest/AdminConfigDefaultCategoryLayoutFromConfigurationSettingTest.xml @@ -24,8 +24,7 @@ <actionGroup ref="RestoreLayoutSetting" stepKey="sampleActionGroup"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminOpenWebConfigurationPageActionGroup" stepKey="navigateToWebConfigurationPage"/> <conditionalClick stepKey="expandDefaultLayouts" selector="{{WebSection.DefaultLayoutsTab}}" dependentSelector="{{WebSection.CheckIfTabExpand}}" visible="true"/> <waitForElementVisible selector="{{DefaultLayoutsSection.categoryLayout}}" stepKey="waitForDefaultCategoryLayout"/> <seeOptionIsSelected selector="{{DefaultLayoutsSection.categoryLayout}}" userInput="No layout updates" stepKey="seeNoLayoutUpdatesSelected"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest/AdminConfigDefaultProductLayoutFromConfigurationSettingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest/AdminConfigDefaultProductLayoutFromConfigurationSettingTest.xml index 7317f2f7214f0..ac2e86a572455 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest/AdminConfigDefaultProductLayoutFromConfigurationSettingTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest/AdminConfigDefaultProductLayoutFromConfigurationSettingTest.xml @@ -24,8 +24,7 @@ <actionGroup ref="RestoreLayoutSetting" stepKey="sampleActionGroup"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminOpenWebConfigurationPageActionGroup" stepKey="navigateToWebConfigurationPage"/> <conditionalClick stepKey="expandDefaultLayouts" selector="{{WebSection.DefaultLayoutsTab}}" dependentSelector="{{WebSection.CheckIfTabExpand}}" visible="true"/> <waitForElementVisible selector="{{DefaultLayoutsSection.productLayout}}" stepKey="DefaultProductLayout"/> <selectOption selector="{{DefaultLayoutsSection.productLayout}}" userInput="3 columns" stepKey="select3ColumnsLayout"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml index 0eac31c891e64..8f82c1f4d6cc0 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml @@ -25,8 +25,7 @@ <actionGroup ref="RestoreLayoutSetting" stepKey="sampleActionGroup"/> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminOpenWebConfigurationPageActionGroup" stepKey="navigateToWebConfigurationPage"/> <conditionalClick stepKey="expandDefaultLayouts" selector="{{WebSection.DefaultLayoutsTab}}" dependentSelector="{{WebSection.CheckIfTabExpand}}" visible="true" /> <waitForElementVisible selector="{{DefaultLayoutsSection.pageLayout}}" stepKey="DefaultProductLayout" /> <seeOptionIsSelected selector="{{DefaultLayoutsSection.pageLayout}}" userInput="1 column" stepKey="seeOneColumnSelected" /> From 3cfa6aa4b231140bea835b99508dc2804c8a09d4 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Sun, 23 Aug 2020 22:14:36 +0300 Subject: [PATCH 30/33] v8 add AdminOpenAdminThreeDSecurePageActionGroup --- ...inOpenAdminThreeDSecurePageActionGroup.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/code/Magento/CardinalCommerce/Test/Mftf/ActionGroup/AdminOpenAdminThreeDSecurePageActionGroup.xml diff --git a/app/code/Magento/CardinalCommerce/Test/Mftf/ActionGroup/AdminOpenAdminThreeDSecurePageActionGroup.xml b/app/code/Magento/CardinalCommerce/Test/Mftf/ActionGroup/AdminOpenAdminThreeDSecurePageActionGroup.xml new file mode 100644 index 0000000000000..baea26921a625 --- /dev/null +++ b/app/code/Magento/CardinalCommerce/Test/Mftf/ActionGroup/AdminOpenAdminThreeDSecurePageActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminOpenAdminThreeDSecurePageActionGroup"> + <annotations> + <description>Open ThreeDSecure page.</description> + </annotations> + + <amOnPage url="{{AdminThreeDSecurePage.url}}" stepKey="openAdminThreeDSecurePage"/> + <waitForPageLoad stepKey="waitThreeDSecurePageToLoad"/> + </actionGroup> +</actionGroups> From 45f834c3648f1663896519139726c32c9b264fc6 Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 24 Aug 2020 21:09:35 +0300 Subject: [PATCH 31/33] use action group go to checkout --- .../Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml | 3 +-- .../StorefrontTaxQuoteCheckoutGuestSimpleTest.xml | 3 +-- .../StorefrontTaxQuoteCheckoutGuestVirtualTest.xml | 3 +-- .../StorefrontTaxQuoteCheckoutLoggedInSimpleTest.xml | 3 +-- .../StorefrontTaxQuoteCheckoutLoggedInVirtualTest.xml | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml index 43390598f7cb3..4f68c055f2615 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/GuestCheckoutWithEnabledPersistentTest.xml @@ -48,8 +48,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> <click selector="{{CheckoutShippingGuestInfoSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> <!-- Check that have the same values after page reload --> - <amOnPage url="{{CheckoutPage.url}}" stepKey="amOnCheckoutShippingInfoPage"/> - <waitForPageLoad stepKey="waitForShippingPageReload"/> + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="amOnCheckoutShippingInfoPage"/> <seeInField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeEmailOnCheckout" /> <seeInField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstName}}" stepKey="seeFirstnameOnCheckout" /> <seeInField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastName}}" stepKey="seeLastnameOnCheckout" /> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestSimpleTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestSimpleTest.xml index b9c3baab8c0dd..d2f1b1aa44393 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestSimpleTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestSimpleTest.xml @@ -79,8 +79,7 @@ <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You added"/> <!-- Fill in address for CA --> - <amOnPage url="{{CheckoutPage.url}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForShippingSection"/> + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> <fillField selector="{{CheckoutShippingSection.email}}" userInput="{{Simple_US_Customer_CA.email}}" stepKey="enterEmail"/> <waitForLoadingMaskToDisappear stepKey="waitEmailLoad"/> <actionGroup ref="LoggedInCheckoutFillNewBillingAddressActionGroup" stepKey="changeAddress"> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestVirtualTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestVirtualTest.xml index 8fafbd9986c64..5441664d7c530 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestVirtualTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutGuestVirtualTest.xml @@ -79,8 +79,7 @@ <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You added"/> <!-- Assert that taxes are applied correctly for CA --> - <amOnPage url="{{CheckoutPage.url}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForShippingSection"/> + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> <waitForElementVisible stepKey="waitForOverviewVisible" selector="{{CheckoutPaymentSection.tax}}"/> <see stepKey="seeTax2" selector="{{CheckoutPaymentSection.tax}}" userInput="$8.25"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInSimpleTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInSimpleTest.xml index ae988cd43efd5..76f4dcd8e161e 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInSimpleTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInSimpleTest.xml @@ -94,8 +94,7 @@ <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You added"/> <!-- Assert that taxes are applied correctly for NY --> - <amOnPage url="{{CheckoutPage.url}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForShippingSection"/> + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> <see stepKey="seeAddress" selector="{{CheckoutShippingSection.selectedShippingAddress}}" userInput="{{SimpleTaxNY.state}}"/> <actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInVirtualTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInVirtualTest.xml index 6552d31a8a523..c98765976f36f 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInVirtualTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest/StorefrontTaxQuoteCheckoutLoggedInVirtualTest.xml @@ -94,8 +94,7 @@ <see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You added"/> <!-- Assert that taxes are applied correctly for NY --> - <amOnPage url="{{CheckoutPage.url}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForShippingSection"/> + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goToCheckout"/> <!-- Checkout select Check/Money Order payment --> <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <see stepKey="seeAddress" selector="{{CheckoutShippingSection.defaultShipping}}" userInput="{{SimpleTaxNY.state}}"/> From cef3fe7efc2403feec6eb550348d03ecb25c6f95 Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Thu, 27 Aug 2020 09:29:34 +0300 Subject: [PATCH 32/33] fix static --- app/code/Magento/Dhl/Model/Carrier.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 9277a070e28d1..204094571ba3b 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -1768,9 +1768,8 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') */ $nodeShipmentDetails->addChild('DoorTo', 'DD'); $nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(), 0, 1)); - if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) { - $packageType = 'CP'; - } + $contentType = isset($package['params']['container']) ? $package['params']['container'] : ''; + $packageType = $contentType === self::DHL_CONTENT_TYPE_NON_DOC ? 'CP' : ''; $nodeShipmentDetails->addChild('PackageType', $packageType); if ($this->isDutiable($rawRequest->getOrigCountryId(), $rawRequest->getDestCountryId())) { $nodeShipmentDetails->addChild('IsDutiable', 'Y'); From 0649a6f23e5afb54edda77e8f06c8fcbd6f0c177 Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Tue, 1 Sep 2020 10:11:20 +0300 Subject: [PATCH 33/33] add story --- .../Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml index c174d1faed31a..1ab277b4f788a 100644 --- a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml +++ b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationToolbarBlockAclTest.xml @@ -11,6 +11,7 @@ <test name="AdminSystemNotificationToolbarBlockAclTest"> <annotations> <features value="AdminNotification"/> + <stories value="Acl notification toolbar"/> <title value="Admin system notification toolbar block acl test"/> <description value="Admin should not see system notification toolbar block if acl not restricted"/> <severity value="MAJOR"/>