Skip to content

Commit

Permalink
Merge branch '2.4-develop' into phpunit8/module-ConfigurableProduct
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-sviziev authored Apr 16, 2020
2 parents 6d922fe + e5ea17f commit 2e9a643
Show file tree
Hide file tree
Showing 231 changed files with 5,231 additions and 1,446 deletions.
22 changes: 13 additions & 9 deletions app/code/Magento/Amqp/Test/Unit/Setup/ConfigOptionsListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

namespace Magento\Amqp\Test\Unit\Setup;

use Magento\Amqp\Setup\ConnectionValidator;
use Magento\Framework\Config\Data\ConfigData;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Amqp\Setup\ConfigOptionsList;
use Magento\Framework\Setup\Option\TextConfigOption;
use Magento\Framework\App\DeploymentConfig;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class ConfigOptionsListTest extends \PHPUnit\Framework\TestCase
class ConfigOptionsListTest extends TestCase
{
/**
* @var ObjectManager
Expand All @@ -24,12 +28,12 @@ class ConfigOptionsListTest extends \PHPUnit\Framework\TestCase
private $model;

/**
* @var \Magento\Amqp\Setup\ConnectionValidator|\PHPUnit_Framework_MockObject_MockObject
* @var ConnectionValidator|MockObject
*/
private $connectionValidatorMock;

/**
* @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
* @var DeploymentConfig|MockObject
*/
private $deploymentConfigMock;

Expand All @@ -38,7 +42,7 @@ class ConfigOptionsListTest extends \PHPUnit\Framework\TestCase
*/
private $options;

protected function setUp()
protected function setUp(): void
{
$this->options = [
ConfigOptionsList::INPUT_KEY_QUEUE_AMQP_HOST => 'host',
Expand All @@ -51,18 +55,18 @@ protected function setUp()
];

$this->objectManager = new ObjectManager($this);
$this->connectionValidatorMock = $this->getMockBuilder(\Magento\Amqp\Setup\ConnectionValidator::class)
$this->connectionValidatorMock = $this->getMockBuilder(ConnectionValidator::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();

$this->deploymentConfigMock = $this->getMockBuilder(\Magento\Framework\App\DeploymentConfig::class)
$this->deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();

$this->model = $this->objectManager->getObject(
\Magento\Amqp\Setup\ConfigOptionsList::class,
ConfigOptionsList::class,
[
'connectionValidator' => $this->connectionValidatorMock,
]
Expand Down Expand Up @@ -135,9 +139,9 @@ public function testCreateConfig($options, $expectedConfigData)
$result = $this->model->createConfig($options, $this->deploymentConfigMock);
$this->assertInternalType('array', $result);
$this->assertNotEmpty($result);
/** @var \Magento\Framework\Config\Data\ConfigData $configData */
/** @var ConfigData $configData */
$configData = $result[0];
$this->assertInstanceOf(\Magento\Framework\Config\Data\ConfigData::class, $configData);
$this->assertInstanceOf(ConfigData::class, $configData);
$this->assertEquals($expectedConfigData, $configData->getData());
}

Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/AsynchronousOperations/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"require": {
"magento/framework": "*",
"magento/framework-message-queue": "*",
"magento/framework-bulk": "*",
"magento/module-authorization": "*",
"magento/module-backend": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/>
<!-- Create invoice -->
<comment userInput="Create invoice" stepKey="createInvoice"/>
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>

<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
<waitForPageLoad stepKey="waitForInvoicePageToLoad"/>
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
Expand All @@ -95,8 +95,7 @@
<comment userInput="Create Shipment for the order" stepKey="createShipmentForOrder"/>
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage2"/>
<waitForPageLoad time="30" stepKey="waitForOrderListPageLoading"/>
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="openOrderPageForShip"/>
<waitForPageLoad stepKey="waitForOrderDetailsPage"/>
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="openOrderPageForShip"/>
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
<waitForPageLoad stepKey="waitForShipmentPagePage"/>
<seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderById">
<argument name="orderId" value="$grabOrderNumber"/>
</actionGroup>
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
<waitForPageLoad stepKey="waitForAdminOrderPageLoad"/>

<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
<scrollTo selector="{{AdminOrderTotalSection.subTotal}}" stepKey="scrollToOrderTotalSection"/>
<see selector="{{AdminOrderTotalSection.subTotal}}" userInput="$0.00" stepKey="checkSubtotal"/>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
<deleteData createDataKey="simpleProduct4" stepKey="deleteSimpleProduct4"/>
</after>
<!--Make category-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/>
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="goToCategoryPage"/>
<actionGroup ref="CreateCategoryActionGroup" stepKey="createASubcategory">
<argument name="categoryEntity" value="SimpleSubCategory"/>
</actionGroup>
Expand Down
9 changes: 8 additions & 1 deletion app/code/Magento/Catalog/Block/Product/ListProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ public function getLayer()
*/
public function getLoadedProductCollection()
{
return $this->_getProductCollection();
$collection = $this->_getProductCollection();

$categoryId = $this->getLayer()->getCurrentCategory()->getId();
foreach ($collection as $product) {
$product->setData('category_id', $categoryId);
}

return $collection;
}

/**
Expand Down
9 changes: 7 additions & 2 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,14 @@ public function getIdBySku($sku)
*/
public function getCategoryId()
{
if ($this->hasData('category_id')) {
return $this->getData('category_id');
}
$category = $this->_registry->registry('current_category');
if ($category && in_array($category->getId(), $this->getCategoryIds())) {
return $category->getId();
$categoryId = $category ? $category->getId() : null;
if ($categoryId && in_array($categoryId, $this->getCategoryIds())) {
$this->setData('category_id', $categoryId);
return $categoryId;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
<severity value="CRITICAL"/>
<testCaseId value="MAGETWO-84373"/>
</annotations>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToNewCatalog"/>
<waitForPageLoad stepKey="wait1"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="navigateToNewCatalog"/>
<waitForLoadingMaskToDisappear stepKey="wait2" />
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="enterCategoryName"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Open Category Page-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create subcategory under parent category -->
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Open Category Page-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create subcategory under parent category -->
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Open Category Page-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create subcategory under parent category -->
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@
<seeInField selector="{{AdminCatalogStorefrontConfigSection.productsPerPageDefaultValue}}" userInput="12" stepKey="seeDefaultValueProductPerPage"/>
<!--Open Category Page and select created category-->
<comment userInput="Open Category Page and select created category" stepKey="commentOpenCategoryPage"/>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoad1"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
<waitForPageLoad stepKey="waitForPageToLoad0"/>
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(_defaultCategory.name)}}" stepKey="selectCreatedCategory"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Open Category Page-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create subcategory under parent category -->
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickOnExpandTree"/>
<waitForPageLoad stepKey="waitForCategoryToLoad"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/>
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="navigateToCategoryPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="enterCategoryName"/>
<click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="clickOnDisplaySettingsTab"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
<seeOptionIsSelected selector="{{DefaultLayoutsSection.categoryLayout}}" userInput="No layout updates" stepKey="seeNoLayoutUpdatesSelected"/>
<selectOption selector="{{DefaultLayoutsSection.categoryLayout}}" userInput="2 columns with right bar" stepKey="select2ColumnsLayout"/>
<click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig"/>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToNewCatalog"/>
<waitForPageLoad stepKey="wait1"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="navigateToNewCatalog"/>
<waitForLoadingMaskToDisappear stepKey="wait2"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
<click selector="{{CategoryDesignSection.DesignTab}}" stepKey="clickOnDesignTab"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
</after>

<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/>
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="navigateToCategoryPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategory"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="enterCategoryName"/>
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSEO"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
<deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/>
</after>
<!--Create SubCategory-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
</actionGroup>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create Root Category-->
<actionGroup ref="AdminCreateRootCategory" stepKey="createNewRootCategory">
<argument name="categoryEntity" value="NewRootCategory"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
</before>
<after>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/>
<waitForPageLoad time="60" stepKey="waitForCategoryPageLoad"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="goToCategoryPage"/>
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="clickCategoryLink"/>
<click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/>
<waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/>
Expand All @@ -36,8 +35,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Create Category with Five Nesting -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create Nested First Category-->
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- Create In active Category -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<click selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="disableCategory"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.IncludeInMenu}}" stepKey="enableIncludeInMenu"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Create Category with not included in menu Subcategory -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
<click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="disableIncludeInMenu"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
</after>

<!--Create SubCategory-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
<waitForPageLoad stepKey="waitForProductSaved"/>
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForPageToLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<!--Create sub category-->
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- Create subcategory with required fields -->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/>
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/>
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
Expand Down
Loading

0 comments on commit 2e9a643

Please sign in to comment.