Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mtf-eol' into MC-4673
Browse files Browse the repository at this point in the history
  • Loading branch information
tomreece committed May 17, 2019
2 parents 5ab9d83 + c09e4af commit 4617e53
Show file tree
Hide file tree
Showing 293 changed files with 6,955 additions and 875 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
@@ -0,0 +1,15 @@
<?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="AssertOrderGraphImageOnDashboardActionGroup">
<click selector="{{AdminDashboardSection.ordersTab}}" stepKey="clickOrdersBtn"/>
<seeElement selector="{{AdminDashboardSection.ordersChart}}" stepKey="seeGraphImage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminDashboardPage" url="admin/dashboard/" area="admin" module="Magento_Backend">
<section name="AdminMenuSection"/>
<section name="AdminDashboardSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminDashboardSection">
<element name="ordersTab" type="button" selector="#diagram_tab_orders"/>
<element name="ordersChart" type="button" selector="#diagram_tab_orders_content .dashboard-diagram-image img"/>
<element name="dashboardDiagramContent" type="button" selector="#diagram_tab_content"/>
<element name="dashboardDiagramOrderContentTab" type="block" selector="#diagram_tab_orders_content"/>
<element name="dashboardDiagramAmounts" type="button" selector="#diagram_tab_amounts"/>
Expand Down
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 @@ -12,6 +12,7 @@
<argument name="product" defaultValue="product"/>
</arguments>
<amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/>
<waitForPageLoad stepKey="waitForProductPage"/>
<click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/>
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="CatalogInventoryOptionsShowOutOfStockEnable">
<data key="path">cataloginventory/options/show_out_of_stock</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="CatalogInventoryOptionsShowOutOfStockDisable">
<!-- Magento default value -->
<data key="path">cataloginventory/options/show_out_of_stock</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>
<entity name="CatalogInventoryItemOptionsBackordersEnable">
<data key="path">cataloginventory/item_options/backorders</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="CatalogInventoryItemOptionsBackordersDisable">
<!-- Magento default value -->
<data key="path">cataloginventory/item_options/backorders</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>
</entities>
12 changes: 12 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@
<data key="status">1</data>
<data key="quantity">0</data>
</entity>
<entity name="SimpleProductInStockQuantityZero" type="product">
<data key="sku" unique="suffix">testSku</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">SimpleProductInStockQuantityZero</data>
<data key="price">123.00</data>
<data key="urlKey" unique="suffix">SimpleProductInStockQuantityZero</data>
<data key="status">1</data>
<data key="quantity">0</data>
<requiredEntity type="product_extension_attribute">EavStock0</requiredEntity>
</entity>
<!-- Simple Product Disabled -->
<entity name="SimpleProductOffline" type="product2">
<data key="sku" unique="suffix">testSku</data>
Expand Down
Loading

0 comments on commit 4617e53

Please sign in to comment.