Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3-develop' into mtf-eol
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyau committed May 13, 2019
2 parents 1e7ea98 + 5253029 commit 3acf193
Show file tree
Hide file tree
Showing 186 changed files with 3,557 additions and 652 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
- [ ] Pull request has a meaningful description of its purpose
- [ ] All commits are accompanied by meaningful commit messages
- [ ] All new or changed code is covered with unit/integration tests (if applicable)
- [ ] All automated tests passed successfully (all builds on Travis CI are green)
- [ ] All automated tests passed successfully (all builds are green)
File renamed without changes.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.3-develop)](https://travis-ci.org/magento/magento2)
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg)](https://crowdin.com/project/magento-2)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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="AssertAdminPageIsNot404ActionGroup">
<dontSee userInput="404 Error" selector="{{AdminHeaderSection.pageHeading}}" stepKey="dontSee404PageHeading"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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="AssertMessageInAdminPanelActionGroup">
<arguments>
<argument name="message" type="string" />
<argument name="messageType" type="string" defaultValue="success" />
</arguments>

<waitForElementVisible selector="{{AdminMessagesSection.messageByType(messageType)}}" stepKey="waitForMessageVisible" />
<see userInput="{{message}}" selector="{{AdminMessagesSection.messageByType(messageType)}}" stepKey="verifyMessage" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
<section name="AdminHeaderSection">
<element name="pageTitle" type="text" selector=".page-header h1.page-title"/>
<element name="adminUserAccountText" type="text" selector=".page-header .admin-user-account-text" />
<!-- Legacy heading section. Mostly used for admin 404 and 403 pages -->
<element name="pageHeading" type="text" selector=".page-content .page-heading"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
<element name="nthSuccess" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
<element name="error" type="text" selector="#messages div.message-error"/>
<element name="notice" type="text" selector=".message.message-notice.notice"/>
<element name="messageByType" type="text" selector="#messages div.message-{{messageType}}" parameterized="true" />
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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="AdminLoginAfterJSMinificationTest">
<annotations>
<features value="Backend"/>
<title value="Admin panel should be accessible with JS minification enabled"/>
<description value="Admin panel should be accessible with JS minification enabled"/>
<testCaseId value="MC-14104" />
<group value="backend"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/>
<actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/>
</test>
</tests>
9 changes: 3 additions & 6 deletions app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public function getAddToCartUrl($product, $additional = [])
}

/**
* Get JSON encoded configuration array which can be used for JS dynamic
* price calculation depending on product options
* Get JSON encoded configuration which can be used for JS dynamic price calculation depending on product options
*
* @return string
*/
Expand Down Expand Up @@ -262,6 +261,7 @@ public function isStartCustomization()

/**
* Get default qty - either as preconfigured, or as 1.
*
* Also restricts it by minimal qty.
*
* @param null|\Magento\Catalog\Model\Product $product
Expand Down Expand Up @@ -323,10 +323,7 @@ public function getQuantityValidators()
public function getIdentities()
{
$identities = $this->getProduct()->getIdentities();
$category = $this->_coreRegistry->registry('current_category');
if ($category) {
$identities[] = Category::CACHE_TAG . '_' . $category->getId();
}

return $identities;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;

/**
* Product aoptions section abstract block.
* Product options section abstract block.
*
* phpcs:disable Magento2.Classes.AbstractApi
* @api
* @since 100.0.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function prepareProductAttributes(Product $product, array $productData, a
}

/**
* Reset "Use Config Settings" to false in product data.
*
* @param Product $product
* @param string $attributeCode
* @param array $productData
Expand All @@ -62,6 +64,8 @@ private function prepareConfigData(Product $product, string $attributeCode, arra
}

/**
* Prepare default attribute data for product.
*
* @param array $attributeList
* @param string $attributeCode
* @param array $productData
Expand All @@ -73,7 +77,7 @@ private function prepareDefaultData(array $attributeList, string $attributeCode,
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
$attribute = $attributeList[$attributeCode];
$attributeType = $attribute->getBackendType();
// For non-numberic types set the attributeValue to 'false' to trigger their removal from the db
// For non-numeric types set the attributeValue to 'false' to trigger their removal from the db
if ($attributeType === 'varchar' || $attributeType === 'text' || $attributeType === 'datetime') {
$attribute->setIsRequired(false);
$productData[$attributeCode] = false;
Expand All @@ -86,6 +90,8 @@ private function prepareDefaultData(array $attributeList, string $attributeCode,
}

/**
* Check, whether attribute should not be updated.
*
* @param Product $product
* @param array $useDefaults
* @param string $attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

namespace Magento\Catalog\Model\Product\Attribute\Backend\TierPrice;

use Magento\Framework\EntityManager\Operation\ExtensionInterface;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Locale\FormatInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
use Magento\Customer\Api\GroupManagementInterface;
Expand Down Expand Up @@ -40,26 +41,34 @@ class UpdateHandler extends AbstractHandler
*/
private $tierPriceResource;

/**
* @var FormatInterface
*/
private $localeFormat;

/**
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
* @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $tierPriceResource
* @param FormatInterface|null $localeFormat
*/
public function __construct(
StoreManagerInterface $storeManager,
ProductAttributeRepositoryInterface $attributeRepository,
GroupManagementInterface $groupManagement,
MetadataPool $metadataPool,
Tierprice $tierPriceResource
Tierprice $tierPriceResource,
FormatInterface $localeFormat = null
) {
parent::__construct($groupManagement);

$this->storeManager = $storeManager;
$this->attributeRepository = $attributeRepository;
$this->metadataPoll = $metadataPool;
$this->tierPriceResource = $tierPriceResource;
$this->localeFormat = $localeFormat ?: ObjectManager::getInstance()->get(FormatInterface::class);
}

/**
Expand Down Expand Up @@ -125,8 +134,9 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool
{
$isChanged = false;
foreach ($valuesToUpdate as $key => $value) {
if ((!empty($value['value']) && (float)$oldValues[$key]['price'] !== (float)$value['value'])
|| $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value)
if ((!empty($value['value'])
&& (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value'])
) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value)
) {
$price = new \Magento\Framework\DataObject(
[
Expand Down
22 changes: 16 additions & 6 deletions app/code/Magento/Catalog/Model/Product/Option/Type/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

/**
* Catalog product option select type
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
{
Expand All @@ -30,23 +32,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
*/
protected $string;

/**
* @var array
*/
private $singleSelectionTypes;

/**
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\Stdlib\StringUtils $string
* @param \Magento\Framework\Escaper $escaper
* @param array $data
* @param array $singleSelectionTypes
*/
public function __construct(
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Stdlib\StringUtils $string,
\Magento\Framework\Escaper $escaper,
array $data = []
array $data = [],
array $singleSelectionTypes = []
) {
$this->string = $string;
$this->_escaper = $escaper;
parent::__construct($checkoutSession, $scopeConfig, $data);

$this->singleSelectionTypes = $singleSelectionTypes ?: [
'drop_down' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
'radio' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
];
}

/**
Expand Down Expand Up @@ -310,10 +324,6 @@ public function getOptionSku($optionValue, $skuDelimiter)
*/
protected function _isSingleSelection()
{
$single = [
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
];
return in_array($this->getOption()->getType(), $single);
return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Magento\Framework\DB\Select;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\Indexer\DimensionFactory;
use Magento\Framework\Model\ResourceModel\ResourceModelPoolInterface;
use Magento\Store\Model\Indexer\WebsiteDimensionProvider;
use Magento\Store\Model\Store;

Expand Down Expand Up @@ -808,7 +807,7 @@ public function load($printQuery = false, $logQuery = false)
}

/**
* Processs adding product website names to result collection
* Process adding product website names to result collection
*
* @return $this
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<element name="ProductDataMayBeLostModal" type="button" selector="//aside[contains(@class,'_show')]//header[contains(.,'Product data may be lost')]"/>
<element name="ProductDataMayBeLostConfirmButton" type="button" selector="//aside[contains(@class,'_show')]//button[.='Change Input Type']"/>
<element name="defaultLabel" type="text" selector="//td[contains(text(), '{{attributeName}}')]/following-sibling::td[contains(@class, 'col-frontend_label')]" parameterized="true"/>
<element name="formByStoreId" type="block" selector="//form[contains(@action,'store/{{store_id}}')]" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
<see selector="{{AdminCategoryBasicFieldSection.FieldError('uid')}}" userInput="This is a required field." stepKey="seeErrorMessage"/>
<!-- Verify that the Layered navigation price step field has the required indicator -->
<comment userInput="Check if Layered navigation price field has required indictor icon" stepKey="comment" />
<comment userInput="Check if Layered navigation price field has required indicator icon" stepKey="comment" />
<executeJS function="{{CategoryDisplaySettingsSection.RequiredFieldIndicator('filter_price_range')}}" stepKey="getRequiredFieldIndicator"/>
<assertEquals expected='"*"' expectedType="string" actualType="variable" actual="getRequiredFieldIndicator" message="pass" stepKey="assertRequiredFieldIndicator1"/>
</test>
Expand Down
19 changes: 13 additions & 6 deletions app/code/Magento/Catalog/Test/Unit/Block/Product/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace Magento\Catalog\Test\Unit\Block\Product;

/**
* Class ViewTest
*/
class ViewTest extends \PHPUnit\Framework\TestCase
{
/**
Expand All @@ -25,6 +28,9 @@ class ViewTest extends \PHPUnit\Framework\TestCase
*/
protected $registryMock;

/**
* @inheritDoc
*/
protected function setUp()
{
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
Expand All @@ -36,6 +42,9 @@ protected function setUp()
);
}

/**
* @return void
*/
public function testShouldRenderQuantity()
{
$productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
Expand All @@ -61,28 +70,26 @@ public function testShouldRenderQuantity()
$this->assertEquals(false, $this->view->shouldRenderQuantity());
}

/**
* @return void
*/
public function testGetIdentities()
{
$productTags = ['cat_p_1'];
$product = $this->createMock(\Magento\Catalog\Model\Product::class);
$category = $this->createMock(\Magento\Catalog\Model\Category::class);

$product->expects($this->once())
->method('getIdentities')
->will($this->returnValue($productTags));
$category->expects($this->once())
->method('getId')
->will($this->returnValue(1));
$this->registryMock->expects($this->any())
->method('registry')
->will(
$this->returnValueMap(
[
['product', $product],
['current_category', $category],
]
)
);
$this->assertEquals(['cat_p_1', 'cat_c_1'], $this->view->getIdentities());
$this->assertEquals($productTags, $this->view->getIdentities());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
use Magento\Catalog\Api\Data\ProductRenderInterface;

/**
* Composite, which holds collectors, that collect enought information for
* product render
* Composite, which holds collectors, that collect enough information for product render
*/
class ProductRenderCollectorComposite implements ProductRenderCollectorInterface
{
Expand Down
Loading

0 comments on commit 3acf193

Please sign in to comment.