Skip to content

Commit

Permalink
Merge branch '2.4-develop' into Refactoring-AdminUpdateCategoryAndMak…
Browse files Browse the repository at this point in the history
…eInactiveTest
  • Loading branch information
kate-kyzyma committed Sep 15, 2020
2 parents 4d1cf82 + 70223c0 commit 2afae11
Show file tree
Hide file tree
Showing 280 changed files with 10,852 additions and 1,223 deletions.
10 changes: 5 additions & 5 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#ini_set('display_errors', 1);

/* PHP version validation */
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 70103) {
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 70300) {
if (PHP_SAPI == 'cli') {
echo 'Magento supports PHP 7.1.3 or later. ' .
'Please read https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html';
echo 'Magento supports PHP 7.3.0 or later. ' .
'Please read https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html';
} else {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<p>Magento supports PHP 7.1.3 or later. Please read
<a target="_blank" href="https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html">
<p>Magento supports PHP 7.3.0 or later. Please read
<a target="_blank" href="https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html">
Magento System Requirements</a>.
</div>
HTML;
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Bundle/Model/Product/LinksList.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function __construct(
}

/**
* Bundle Product Items Data
*
* @param \Magento\Catalog\Api\Data\ProductInterface $product
* @param int $optionId
* @return \Magento\Bundle\Api\Data\LinkInterface[]
Expand All @@ -50,8 +52,12 @@ public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product, $o
$productLinks = [];
/** @var \Magento\Catalog\Model\Product $selection */
foreach ($selectionCollection as $selection) {
$bundledProductPrice = $selection->getSelectionPriceValue();
if ($bundledProductPrice <= 0) {
$bundledProductPrice = $selection->getPrice();
}
$selectionPriceType = $product->getPriceType() ? $selection->getSelectionPriceType() : null;
$selectionPrice = $product->getPriceType() ? $selection->getSelectionPriceValue() : null;
$selectionPrice = $bundledProductPrice ? $bundledProductPrice : null;

/** @var \Magento\Bundle\Api\Data\LinkInterface $productLink */
$productLink = $this->linkFactory->create();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest">
<annotations>
<features value="Bundle"/>
<stories value="Bundle product details page"/>
<title value="Customer should be able to see all the bundle items in invoice view"/>
<description value="Customer should be able to see all the bundle items in invoice view"/>
<severity value="MAJOR"/>
<testCaseId value="MC-37515"/>
<group value="Bundle"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
<createData entity="SimpleProduct2" stepKey="firstSimpleProduct"/>
<createData entity="SimpleProduct2" stepKey="secondSimpleProduct"/>
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
<actionGroup stepKey="loginToAdminPanel" ref="AdminLoginActionGroup"/>
</before>
<after>
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
<deleteData createDataKey="firstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
<deleteData createDataKey="secondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- Create new bundle product -->
<actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createBundleProduct">
<argument name="productType" value="bundle"/>
</actionGroup>

<!-- Fill all main fields -->
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainProductFields"/>

<!-- Add first bundle option to the product -->
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addFirstBundleOption">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$firstSimpleProduct.sku$"/>
<argument name="prodTwoSku" value="$secondSimpleProduct.sku$$"/>
<argument name="optionTitle" value="{{CheckboxOption.title}}"/>
<argument name="inputType" value="{{CheckboxOption.type}}"/>
</actionGroup>

<!-- Save product form -->
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveWithThreeOptions"/>

<!--Login customer on storefront-->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
<argument name="Customer" value="$$createCustomer$$" />
</actionGroup>

<!--Open Product Page-->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage">
<argument name="productUrl" value="{{BundleProduct.name}}"/>
</actionGroup>

<!-- Add bundle to cart -->
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickAddToCart">
<argument name="productUrl" value="{{BundleProduct.name}}"/>
</actionGroup>
<checkOption selector="{{StorefrontBundledSection.checkboxOptionThreeProducts(CheckboxOption.title, '1')}}" stepKey="selectOption2Product1"/>
<checkOption selector="{{StorefrontBundledSection.checkboxOptionThreeProducts(CheckboxOption.title, '2')}}" stepKey="selectOption2Product2"/>
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
<argument name="quantity" value="1"/>
</actionGroup>

<!--Navigate to checkout-->
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
<!-- Click next button to open payment section -->
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
<!-- Click place order -->
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="placeOrder"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>

<!-- Order review page has address that was created during checkout -->
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrdersGridById">
<argument name="orderId" value="{$grabOrderNumber}"/>
</actionGroup>

<!-- Open create invoice page -->
<actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/>

<!-- Assert item options display -->
<see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $firstSimpleProduct.sku$" stepKey="seeFirstProductInList"/>
<see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $secondSimpleProduct.sku$" stepKey="seeSecondProductInList"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testLinksList()
->method('getSelectionsCollection')
->with([$optionId], $this->productMock)
->willReturn([$this->selectionMock]);
$this->productMock->expects($this->exactly(2))->method('getPriceType')->willReturn('price_type');
$this->productMock->expects($this->once())->method('getPriceType')->willReturn('price_type');
$this->selectionMock->expects($this->once())
->method('getSelectionPriceType')
->willReturn('selection_price_type');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<?php $items = $block->getChildren($_item); ?>
<?php $_count = count($items) ?>
<?php $_index = 0 ?>
<?php $canEditItemQty = true ?>
<?php
/** @var \Magento\Catalog\Helper\Data $catalogHelper */
$catalogHelper = $block->getData('catalogHelper');
Expand All @@ -37,7 +38,7 @@ $catalogHelper = $block->getData('catalogHelper');
<?php if ($_item->getOrderItem()->getParentItem()): ?>
<?php
if ($shipTogether) {
continue;
$canEditItemQty = false;
}
?>
<?php $attributes = $block->getSelectionAttributes($_item) ?>
Expand Down Expand Up @@ -130,7 +131,7 @@ $catalogHelper = $block->getData('catalogHelper');
</td>
<td class="col-qty-invoice">
<?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?>
<?php if ($block->canEditQty()): ?>
<?php if ($block->canEditQty() && $canEditItemQty): ?>
<input type="text"
class="input-text admin__control-text qty-input"
name="invoice[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>]"
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ public function getJsonConfig()
'productId' => (int)$product->getId(),
'priceFormat' => $this->_localeFormat->getPriceFormat(),
'prices' => [
'baseOldPrice' => [
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount() * 1,
'adjustments' => []
],
'oldPrice' => [
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1,
'adjustments' => []
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ public function backgroundColor($colorRGB)
{
// assume that 3 params were given instead of array
if (!is_array($colorRGB)) {
//phpcs:disable
$colorRGB = func_get_args();
//phpcs:enabled
}
$this->_getModel()->setBackgroundColor($colorRGB);
return $this;
Expand Down Expand Up @@ -498,7 +500,11 @@ protected function initBaseFile()
if ($this->getImageFile()) {
$model->setBaseFile($this->getImageFile());
} else {
$model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
$model->setBaseFile(
$this->getProduct()
? $this->getProduct()->getData($model->getDestinationSubdir())
: ''
);
}
}
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
</annotations>

<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/>
<!-- Should wait a bit for filters really cleared because waitForPageLoad does not wait for javascripts to be finished -->
<!-- Without this test will fail sometimes -->
<wait time="5" stepKey="waitFilterReallyCleared"/>
<reloadPage stepKey="reloadPage"/>
</before>

<after>
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,14 @@ public function testGetWidth()
$this->assertEquals($data['width'], $this->helper->getWidth());
}

/**
* Check initBaseFile without properties - product
*/
public function testGetUrlWithOutProduct()
{
$this->assertNull($this->helper->getUrl());
}

/**
* @param array $data
* @dataProvider getHeightDataProvider
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(
public function getCategoryUrlSuffix()
{
return $this->scopeConfig->getValue(
static::XML_PATH_CATEGORY_URL_SUFFIX,
self::XML_PATH_CATEGORY_URL_SUFFIX,
ScopeInterface::SCOPE_STORE
);
}
Expand All @@ -84,7 +84,7 @@ public function getCategoryUrlSuffix()
public function isCategoryUsedInProductUrl(): bool
{
return $this->scopeConfig->isSetFlag(
static::XML_PATH_PRODUCT_USE_CATEGORIES,
self::XML_PATH_PRODUCT_USE_CATEGORIES,
ScopeInterface::SCOPE_STORE
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ $_helper = $block->getData('outputHelper');
<?= $block->getBlockHtml('formkey') ?>
<button type="submit"
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>"
class="action tocart primary">
class="action tocart primary"
disabled>
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ define([
if (this.options.bindSubmit) {
this._bindSubmit();
}
$(this.options.addToCartButtonSelector).attr('disabled', false);
},

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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="AdminFillCatalogProductsListWidgetTitleActionGroup">
<annotations>
<description>Fill catalog products list title field.</description>
</annotations>

<arguments>
<argument name="title" type="string" defaultValue=""/>
</arguments>
<waitForElementVisible selector="{{InsertWidgetSection.title}}" stepKey="waitForField"/>
<fillField selector="{{InsertWidgetSection.title}}" userInput="{{title}}" stepKey="fillTitleField"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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="StorefrontAssertWidgetTitleActionGroup">
<annotations>
<description>Assert widget title on storefront.</description>
</annotations>
<arguments>
<argument name="title" type="string"/>
</arguments>

<grabTextFrom selector="{{StorefrontWidgetsSection.widgetProductsGrid}} {{StorefrontWidgetsSection.widgetTitle}}"
stepKey="grabWidgetTitle"/>
<assertEquals stepKey="assertWidgetTitle">
<actualResult type="string">$grabWidgetTitle</actualResult>
<expectedResult type="string">{{title}}</expectedResult>
</assertEquals>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<element name="checkElementStorefrontByPrice" type="button" selector="//*[@class='product-items widget-product-grid']//*[contains(text(),'${{arg4}}.00')]" parameterized="true"/>
<element name="checkElementStorefrontByName" type="button" selector="//*[@class='product-items widget-product-grid']//*[@class='product-item'][{{productPosition}}]//a[contains(text(), '{{productName}}')]" parameterized="true"/>
<element name="categoryTreeWrapper" type="text" selector=".rule-chooser .tree.x-tree"/>
<element name="title" type="text" selector="input[name='parameters[title]']"/>
</section>
</sections>
Loading

0 comments on commit 2afae11

Please sign in to comment.