Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.3-develop' into 2.3-develop-…
Browse files Browse the repository at this point in the history
…issue-20924
  • Loading branch information
p-bystritsky committed Feb 5, 2019
2 parents 01d68c6 + 8dfe26a commit 0b5e0e2
Show file tree
Hide file tree
Showing 203 changed files with 5,837 additions and 978 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontFillCartDataActionGroup">
<arguments>
<argument name="cartData" defaultValue="PaymentAndShippingInfo"/>
</arguments>
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.cartFrame}}" stepKey="switchToIframe"/>
<waitForElementVisible selector="{{BraintreeConfigurationPaymentSection.cartCode}}" stepKey="waitCartCodeElement"/>
<fillField selector="{{BraintreeConfigurationPaymentSection.cartCode}}" userInput="{{cartData.cardNumber}}" stepKey="setCartCode"/>
<switchToIFrame stepKey="switchBack"/>
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.monthFrame}}" stepKey="switchToIframe1"/>
<waitForElementVisible selector="{{BraintreeConfigurationPaymentSection.month}}" stepKey="waitMonthElement"/>
<fillField selector="{{BraintreeConfigurationPaymentSection.month}}" userInput="{{cartData.month}}" stepKey="setMonth"/>
<switchToIFrame stepKey="switchBack1"/>
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.yearFrame}}" stepKey="switchToIframe2"/>
<waitForElementVisible selector="{{BraintreeConfigurationPaymentSection.year}}" stepKey="waitYearElement"/>
<fillField selector="{{BraintreeConfigurationPaymentSection.year}}" userInput="{{cartData.year}}" stepKey="setYear"/>
<switchToIFrame stepKey="switchBack2"/>
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.codeFrame}}" stepKey="switchToIframe3"/>
<waitForElementVisible selector="{{BraintreeConfigurationPaymentSection.verificationNumber}}" stepKey="waitVerificationNumber"/>
<fillField selector="{{BraintreeConfigurationPaymentSection.verificationNumber}}" userInput="{{cartData.cvv}}" stepKey="setVerificationNumber"/>
<switchToIFrame stepKey="SwitchBackToWindow"/>

</actionGroup>

</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<severity value="CRITICAL"/>
<testCaseId value="MAGETWO-93677"/>
<group value="braintree"/>
<skip>
<issueId value="MC-13779"/>
</skip>
</annotations>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoSimpleProductTest">
<annotations>
<features value="Bundle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest">
<annotations>
<features value="Bundle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdvanceCatalogSearchBundleByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest">
<annotations>
<features value="Bundle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function __construct(
* Add parent id/sku pair to use for option filter at fetch time.
*
* @param int $parentId
* @param int $parentEntityId
* @param string $sku
*/
public function addParentFilterData(int $parentId, int $parentEntityId, string $sku) : void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="CaptchaFormsDisplayingTest">
<annotations>
<features value="Captcha"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Controller\Adminhtml\Category;

use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;

/**
* Class RefreshPath
*/
class RefreshPath extends \Magento\Catalog\Controller\Adminhtml\Category implements HttpGetActionInterface
{
/**
Expand Down Expand Up @@ -44,6 +46,7 @@ public function execute()
'id' => $categoryId,
'path' => $category->getPath(),
'parentId' => $category->getParentId(),
'level' => $category->getLevel()
]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public function execute()
$parentCategory = $this->getParentCategory($parentId, $storeId);
$category->setPath($parentCategory->getPath());
$category->setParentId($parentCategory->getId());
$category->setLevel(null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions
{
$adminValues = [];
foreach ($optionsValues as $optionKey => $values) {
if (!(isset($deletedOptions[$optionKey]) and $deletedOptions[$optionKey] === '1')) {
if (!(isset($deletedOptions[$optionKey]) && $deletedOptions[$optionKey] === '1')) {
$adminValues[] = reset($values);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,20 @@
<seeElement selector="{{AdminProductMessagesSection.successMessage}}"
stepKey="waitForSuccessMessage"/>
</actionGroup>
<actionGroup name="deleteProductAttributeByLabel">
<arguments>
<argument name="ProductAttribute"/>
</arguments>
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}"
userInput="{{ProductAttribute.default_label}}" stepKey="setAttributeCode"/>
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/>
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/>
<click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}"
stepKey="waitForSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<section name="DropdownAttributeOptionsSection">
<element name="nthOptionAdminLabel" type="input"
selector="(//*[@id='manage-options-panel']//tr[{{var}}]//input[contains(@name, 'option[value]')])[1]" parameterized="true"/>
<element name="deleteButton" type="button" selector="(//td[@class='col-delete'])[1]" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminAddDefaultVideoSimpleProductTest">
<annotations>
<features value="Catalog"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminAddDefaultVideoVirtualProductTest" extends="AdminAddDefaultVideoSimpleProductTest">
<annotations>
<features value="Catalog"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminRemoveDefaultVideoSimpleProductTest">
<annotations>
<features value="Catalog"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminRemoveDefaultVideoVirtualProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest">
<annotations>
<features value="Catalog"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdvanceCatalogSearchVirtualProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest">
<annotations>
<features value="Catalog"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="CheckTierPricingOfProductsTest">
<annotations>
<features value="Shopping Cart"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<severity value="CRITICAL"/>
<testCaseId value="MAGETWO-61717"/>
<group value="Catalog"/>
<!-- skip due to MAGETWO-97424 -->
<group value="skip"/>
</annotations>
<before>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ private function setObjectProperty($object, string $propertyName, $value) : void
*/
public function testExecute() : void
{
$value = ['id' => 3, 'path' => '1/2/3', 'parentId' => 2];
$result = '{"id":3,"path":"1/2/3","parentId":"2"}';
$value = ['id' => 3, 'path' => '1/2/3', 'parentId' => 2, 'level' => 2];
$result = '{"id":3,"path":"1/2/3","parentId":"2","level":"2"}';

$requestMock = $this->getMockForAbstractClass(\Magento\Framework\App\RequestInterface::class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<dataType>text</dataType>
</settings>
</field>
<field name="level" formElement="hidden">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">category</item>
</item>
</argument>
</field>
<field name="store_id" formElement="hidden">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ define([
categoryIdSelector: 'input[name="id"]',
categoryPathSelector: 'input[name="path"]',
categoryParentSelector: 'input[name="parent"]',
categoryLevelSelector: 'input[name="level"]',
refreshUrl: config.refreshUrl
},

Expand Down Expand Up @@ -47,6 +48,7 @@ define([
$(this.options.categoryIdSelector).val(data.id).change();
$(this.options.categoryPathSelector).val(data.path).change();
$(this.options.categoryParentSelector).val(data.parentId).change();
$(this.options.categoryLevelSelector).val(data.level).change();
}
}
};
Expand Down
11 changes: 11 additions & 0 deletions app/code/Magento/CatalogGraphQl/Model/Category/LevelCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
*/
class LevelCalculator
{
/**
* @var ResourceConnection
*/
private $resourceConnection;

/**
* @var Category
*/
private $resourceCategory;

/**
* @param ResourceConnection $resourceConnection
* @param Category $resourceCategory
Expand All @@ -39,6 +49,7 @@ public function calculate(int $rootCategoryId) : int
$select = $connection->select()
->from($this->resourceConnection->getTableName('catalog_category_entity'), 'level')
->where($this->resourceCategory->getLinkField() . " = ?", $rootCategoryId);

return (int) $connection->fetchOne($select);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
use Magento\Framework\DB\Select;
use Magento\Framework\Search\Adapter\Mysql\Aggregation\DataProviderInterface;
use Magento\Framework\Search\Request\BucketInterface;
use Magento\Framework\Event\Manager;

/**
* Data Provider for catalog search.
*
* @deprecated
* @see \Magento\ElasticSearch
*/
Expand All @@ -43,12 +46,18 @@ class DataProvider implements DataProviderInterface
*/
private $selectBuilderForAttribute;

/**
* @var Manager
*/
private $eventManager;

/**
* @param Config $eavConfig
* @param ResourceConnection $resource
* @param ScopeResolverInterface $scopeResolver
* @param null $customerSession @deprecated
* @param SelectBuilderForAttribute|null $selectBuilderForAttribute
* @param Manager|null $eventManager
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
Expand All @@ -57,17 +66,19 @@ public function __construct(
ResourceConnection $resource,
ScopeResolverInterface $scopeResolver,
$customerSession,
SelectBuilderForAttribute $selectBuilderForAttribute = null
SelectBuilderForAttribute $selectBuilderForAttribute = null,
Manager $eventManager = null
) {
$this->eavConfig = $eavConfig;
$this->connection = $resource->getConnection();
$this->scopeResolver = $scopeResolver;
$this->selectBuilderForAttribute = $selectBuilderForAttribute
?: ObjectManager::getInstance()->get(SelectBuilderForAttribute::class);
$this->eventManager = $eventManager ?: ObjectManager::getInstance()->get(Manager::class);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDataSet(
BucketInterface $bucket,
Expand All @@ -83,20 +94,26 @@ public function getDataSet(
'main_table.entity_id = entities.entity_id',
[]
);
$this->eventManager->dispatch(
'catalogsearch_query_add_filter_after',
['bucket' => $bucket, 'select' => $select]
);
$select = $this->selectBuilderForAttribute->build($select, $attribute, $currentScope);

return $select;
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function execute(Select $select)
{
return $this->connection->fetchAssoc($select);
}

/**
* Get select.
*
* @return Select
*/
private function getSelect()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,12 @@ private function getOptionCount($value, $optionsFacetedData)
? (int)$optionsFacetedData[$value]['count']
: 0;
}

/**
* @inheritdoc
*/
protected function isOptionReducesResults($optionCount, $totalSize)
{
return $optionCount <= $totalSize;
}
}
Loading

0 comments on commit 0b5e0e2

Please sign in to comment.