Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op latest changes

Accepted Community Pull Requests:
 - #29493: #1742: Cover SynchronizeFilesInterface with integration test (by @jmonteros422)
 - #29427: [MFTF] Add  new AdminSelectAndDeleteProductsActionGroup (by @Usik2203)
 - #28599: Fix failing / warnings in unit tests (by @lbajsarowicz)
 - #29449: Simplified media gallery AssetDetailsProvider implementation (by @sivaschenko)
 - #27758: refactored code (by @ProkopovVitaliy)
 - #28642: Improve html markup thumbnail image (by @mrtuvn)
 - #26175: Static properties serialization fix. (by @p-bystritsky)


Fixed GitHub Issues:
 - #1742: Database fields corrupt default values (reported by @Michal-sk) has been fixed in #29493 by @jmonteros422 in 2.4-develop branch
   Related commits:
     1. faf1de2

 - #26702: StockState.php Are theses comment a feature or a forget ? (reported by @vahir2016) has been fixed in #27758 by @ProkopovVitaliy in 2.4-develop branch
   Related commits:
     1. e527114
     2. 677ddce
     3. 7199dfe
     4. 6d024bb
     5. 707297a
     6. e035f6a

 - #29468: [Issue] Improve html markup thumbnail image (reported by @m2-assistant[bot]) has been fixed in #28642 by @mrtuvn in 2.4-develop branch
   Related commits:
     1. 3337da2
     2. 8f75f1f

 - #28319: [Issue] Static properties serialization fix. (reported by @m2-backlog[bot]) has been fixed in #26175 by @p-bystritsky in 2.4-develop branch
   Related commits:
     1. 9383fe1
     2. 3343d81
     3. 7388d8c
     4. 6bf711b
     5. edfaf7c
     6. c6244ea
     7. 3b7f758
     8. 37b852d
     9. 9210192

 - #29313: [Issue] Static properties serialization fix. (reported by @m2-assistant[bot]) has been fixed in #26175 by @p-bystritsky in 2.4-develop branch
   Related commits:
     1. 9383fe1
     2. 3343d81
     3. 7388d8c
     4. 6bf711b
     5. edfaf7c
     6. c6244ea
     7. 3b7f758
     8. 37b852d
     9. 9210192
  • Loading branch information
magento-engcom-team authored Aug 14, 2020
2 parents c415874 + 4eb6a59 commit 7198c76
Show file tree
Hide file tree
Showing 28 changed files with 558 additions and 615 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,9 @@
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
<argument name="product" value="BundleProduct"/>
</actionGroup>
<click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="SelectAllOnly1"/>
<waitForPageLoad stepKey="loading2"/>

<!--Delete-->
<click selector="{{AdminProductFiltersSection.actions}}" stepKey="ClickOnActionsChangingView"/>
<click selector="{{AdminProductFiltersSection.delete}}" stepKey="ClickDelete"/>
<click selector="//button[@class='action-primary action-accept']" stepKey="ConfirmDelete"/>
<waitForPageLoad stepKey="loading3"/>
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>

<!--Locating delete message-->
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,7 @@
<actionGroup ref="BundleProductFilter" stepKey="FilterForOnlyBundleProducts"/>

<!--Delete-->
<click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="SelectAllOnly1"/>
<waitForPageLoad stepKey="loading"/>
<click selector="{{AdminProductFiltersSection.actions}}" stepKey="ClickOnActionsChangingView"/>
<click selector="{{AdminProductFiltersSection.delete}}" stepKey="ClickDelete"/>
<click selector="//button[@class='action-primary action-accept']" stepKey="ConfirmDelete"/>
<waitForPageLoad stepKey="loading3"/>
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>

<!--Locating delete message-->
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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="AdminDeleteAllProductsFromGridActionGroup">
<annotations>
<description>Select and delete products in product grid.</description>
</annotations>
<click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="selectAllProducts"/>
<click selector="{{AdminProductFiltersSection.actions}}" stepKey="clickOnActionsChangingView"/>
<click selector="{{AdminProductFiltersSection.delete}}" stepKey="clickDelete"/>
<click selector="//button[@class='action-primary action-accept']" stepKey="confirmDelete"/>
<waitForPageLoad stepKey="waitingProductGridLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
namespace Magento\CatalogImportExport\Test\Unit\Model\Export;

use Magento\Catalog\Model\Product\LinkTypeProvider;
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
use Magento\CatalogImportExport\Model\Export\Product;
use Magento\CatalogImportExport\Model\Export\Product\Type\Factory;
use Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite;
use Magento\Eav\Model\Config;
use Magento\Eav\Model\Entity\Collection\AbstractCollection;
use Magento\Eav\Model\Entity\Type;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory as AttributeSetCollectionFactory;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Logger\Monolog;
Expand Down Expand Up @@ -83,7 +85,7 @@ class ProductTest extends TestCase
protected $attrSetColFactory;

/**
* @var \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory|MockObject
* @var CategoryCollectionFactory|MockObject
*/
protected $categoryColFactory;

Expand Down Expand Up @@ -174,15 +176,14 @@ protected function setUp(): void
->onlyMethods(['create'])
->getMock();

$this->attrSetColFactory = $this->getMockBuilder(
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory::class
)->addMethods(['setEntityTypeFilter'])
$this->attrSetColFactory = $this->getMockBuilder(AttributeSetCollectionFactory::class)
->disableOriginalConstructor()
->addMethods(['setEntityTypeFilter'])
->onlyMethods(['create'])
->getMock();

$this->categoryColFactory = $this->getMockBuilder(
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory::class
)->addMethods(['addNameToResult'])
$this->categoryColFactory = $this->getMockBuilder(CategoryCollectionFactory::class)
->disableOriginalConstructor()->addMethods(['addNameToResult'])
->onlyMethods(['create'])
->getMock();

Expand Down
53 changes: 29 additions & 24 deletions app/code/Magento/CatalogInventory/Model/StockState.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
use Magento\CatalogInventory\Api\StockStateInterface;
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;
use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface;
use Magento\Framework\DataObject;

/**
* Provides functionality for stock state information
*
* Interface StockState
*/
class StockState implements StockStateInterface
Expand All @@ -31,6 +34,8 @@ class StockState implements StockStateInterface
protected $stockConfiguration;

/**
* StockState constructor
*
* @param StockStateProviderInterface $stockStateProvider
* @param StockRegistryProviderInterface $stockRegistryProvider
* @param StockConfigurationInterface $stockConfiguration
Expand All @@ -46,30 +51,32 @@ public function __construct(
}

/**
* Verify stock by product id
*
* @param int $productId
* @param int $scopeId
* @return bool
*/
public function verifyStock($productId, $scopeId = null)
{
// if ($scopeId === null) {
$scopeId = $this->stockConfiguration->getDefaultScopeId();
// }
$scopeId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);

return $this->stockStateProvider->verifyStock($stockItem);
}

/**
* Verify notification by product id
*
* @param int $productId
* @param int $scopeId
* @return bool
*/
public function verifyNotification($productId, $scopeId = null)
{
// if ($scopeId === null) {
$scopeId = $this->stockConfiguration->getDefaultScopeId();
// }
$scopeId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);

return $this->stockStateProvider->verifyNotification($stockItem);
}

Expand All @@ -84,16 +91,14 @@ public function verifyNotification($productId, $scopeId = null)
*/
public function checkQty($productId, $qty, $scopeId = null)
{
// if ($scopeId === null) {
$scopeId = $this->stockConfiguration->getDefaultScopeId();
// }
$scopeId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);

return $this->stockStateProvider->checkQty($stockItem, $qty);
}

/**
* Returns suggested qty that satisfies qty increments and minQty/maxQty/minSaleQty/maxSaleQty conditions
* or original qty if such value does not exist
* Returns suggested qty that satisfies qty increments/minQty/maxQty/minSaleQty/maxSaleQty else returns original qty
*
* @param int $productId
* @param float $qty
Expand All @@ -102,10 +107,9 @@ public function checkQty($productId, $qty, $scopeId = null)
*/
public function suggestQty($productId, $qty, $scopeId = null)
{
// if ($scopeId === null) {
$scopeId = $this->stockConfiguration->getDefaultScopeId();
// }
$scopeId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);

return $this->stockStateProvider->suggestQty($stockItem, $qty);
}

Expand All @@ -118,29 +122,31 @@ public function suggestQty($productId, $qty, $scopeId = null)
*/
public function getStockQty($productId, $scopeId = null)
{
// if ($scopeId === null) {
$scopeId = $this->stockConfiguration->getDefaultScopeId();
// }
$scopeId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);

return $this->stockStateProvider->getStockQty($stockItem);
}

/**
* Check qty increments by product id
*
* @param int $productId
* @param float $qty
* @param int $websiteId
* @return \Magento\Framework\DataObject
* @return DataObject
*/
public function checkQtyIncrements($productId, $qty, $websiteId = null)
{
// if ($websiteId === null) {
$websiteId = $this->stockConfiguration->getDefaultScopeId();
// }
$websiteId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $websiteId);

return $this->stockStateProvider->checkQtyIncrements($stockItem, $qty);
}

/**
* Check quote item qty
*
* @param int $productId
* @param float $itemQty
* @param float $qtyToCheck
Expand All @@ -150,10 +156,9 @@ public function checkQtyIncrements($productId, $qty, $websiteId = null)
*/
public function checkQuoteItemQty($productId, $itemQty, $qtyToCheck, $origQty, $scopeId = null)
{
// if ($scopeId === null) {
$scopeId = $this->stockConfiguration->getDefaultScopeId();
// }
$scopeId = $this->stockConfiguration->getDefaultScopeId();
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);

return $this->stockStateProvider->checkQuoteItemQty($stockItem, $itemQty, $qtyToCheck, $origQty);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testExecuteBadType()
->with(
$this->equalTo(['urn:magento:framework:Module/etc/module.xsd' => $fixtureXmlFile]),
$this->equalTo('test')
)->willReturn(null);
);

$formats = ['phpstorm' => $phpstormFormatMock];
$readFactory = $this->createMock(ReadFactory::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<argument name="entityType" xsi:type="string">catalog_category</argument>
</arguments>
</virtualType>
<type name="Magento\MediaGalleryUi\Model\AssetDetailsProvider\UsedIn">
<type name="Magento\MediaGalleryUi\Model\GetAssetUsageDetails">
<arguments>
<argument name="contentTypes" xsi:type="array">
<item name="catalog_category" xsi:type="array">
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/MediaGalleryCmsUi/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<argument name="entityType" xsi:type="string">cms_block</argument>
</arguments>
</virtualType>
<type name="Magento\MediaGalleryUi\Model\AssetDetailsProvider\UsedIn">
<type name="Magento\MediaGalleryUi\Model\GetAssetUsageDetails">
<arguments>
<argument name="contentTypes" xsi:type="array">
<item name="cms_block" xsi:type="array">
Expand Down
Loading

0 comments on commit 7198c76

Please sign in to comment.