Skip to content

Commit

Permalink
Merge pull request #3861 from magento-arcticfoxes/2.3-develop-pr
Browse files Browse the repository at this point in the history
[2.3-develop] Sync with 2.3.1-release
  • Loading branch information
joanhe authored Mar 11, 2019
2 parents 8f737c0 + ba96c2b commit 9d231d1
Show file tree
Hide file tree
Showing 58 changed files with 1,174 additions and 249 deletions.
7 changes: 7 additions & 0 deletions app/code/Magento/AuthorizenetAcceptjs/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<dev>
<js>
<minify_exclude>
<authorizenet_acceptjs>\.authorize\.net/v1/Accept</authorizenet_acceptjs>
</minify_exclude>
</js>
</dev>
<payment>
<authorizenet_acceptjs>
<active>0</active>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
*/

var config = {
map: {
'*': {
acceptjssandbox: 'https://jstest.authorize.net/v1/Accept.js',
acceptjs: 'https://js.authorize.net/v1/Accept.js'
shim: {
acceptjs: {
exports: 'Accept'
},
acceptjssandbox: {
exports: 'Accept'
}
},
paths: {
acceptjssandbox: 'https://jstest.authorize.net/v1/Accept',
acceptjs: 'https://js.authorize.net/v1/Accept'
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define([
dependency = 'acceptjssandbox';
}

require([dependency], function () {
require([dependency], function (accept) {
var $body = $('body');

/*
Expand All @@ -26,16 +26,7 @@ define([
* Dynamically-loading-Accept-js-E-WC-03-Accept-js-is-not-loaded/td-p/63283
*/
$body.on('handshake.acceptjs', function () {
/*
* Accept.js doesn't return the library when loading
* and requirejs "shim" can't be used because it only works with the "paths" config option
* and we can't use "paths" because require will try to load ".min.js" in production
* and that doesn't work because it doesn't exist
* and we can't add a query string to force a URL because accept.js will reject it
* and we can't include it locally because they check in the script before loading more scripts
* So, we use the global version as "shim" would
*/
deferred.resolve(window.Accept);
deferred.resolve(accept);
$body.off('handshake.acceptjs');
});
},
Expand Down
5 changes: 2 additions & 3 deletions app/code/Magento/Catalog/Model/CategoryList.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ public function getList(SearchCriteriaInterface $searchCriteria)
$this->extensionAttributesJoinProcessor->process($collection);

$this->collectionProcessor->process($searchCriteria, $collection);
$collection->load();

$items = [];
foreach ($collection->getItems() as $category) {
$items[] = $this->categoryRepository->get($category->getId());
foreach ($collection->getAllIds() as $id) {
$items[] = $this->categoryRepository->get($id);
}

/** @var CategorySearchResultsInterface $searchResult */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,31 @@
<element name="attributeSetFilterResult" type="input" selector="div[data-index='attribute_set_id'] .action-menu-item._last" timeout="30"/>
<element name="attributeSetFilterResultByName" type="text" selector="//label/span[text() = '{{var}}']" timeout="30" parameterized="true"/>
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
<element name="productNameDisabled" type="input" selector=".admin__field[data-index=name] input[disabled=true]"/>
<element name="RequiredNameIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=name]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
<element name="RequiredSkuIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index=sku]&gt;.admin__field-label span'), ':after').getPropertyValue('content');"/>
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
<element name="productSkuDisabled" type="input" selector=".admin__field[data-index=sku] input[disabled=true]"/>
<element name="enableProductAttributeLabel" type="text" selector="//span[text()='Enable Product']/parent::label"/>
<element name="enableProductAttributeLabelWrapper" type="text" selector="//span[text()='Enable Product']/parent::label/parent::div"/>
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
<element name="productStatusDisabled" type="checkbox" selector="input[name='product[status]'][disabled]"/>
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
<element name="productNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
<element name="productPriceDisabled" type="input" selector=".admin__field[data-index=price] input[disabled=true]"/>
<element name="productPriceUseDefault" type="checkbox" selector=".admin__field[data-index=price] [name='use_default[price]']"/>
<element name="productTaxClass" type="select" selector="//*[@name='product[tax_class_id]']"/>
<element name="productTaxClassDisabled" type="select" selector="select[name='product[tax_class_id]'][disabled=true]"/>
<element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/>
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']" timeout="30"/>
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
<element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/>
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
<element name="advancedInventoryLink" type="button" selector="//button[contains(@data-index, 'advanced_inventory_button')]" timeout="30"/>
<element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']"/>
<element name="productStockStatusDisabled" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]'][disabled=true]"/>
<element name="stockStatus" type="select" selector="[data-index='product-details'] select[name='product[quantity_and_stock_status][is_in_stock]']"/>
<element name="productWeight" type="input" selector=".admin__field[data-index=weight] input"/>
<element name="productWeightSelect" type="select" selector="select[name='product[product_has_weight]']"/>
Expand All @@ -48,6 +55,7 @@
<element name="productFormTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]" parameterized="true"/>
<element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/>
<element name="visibility" type="select" selector="//select[@name='product[visibility]']"/>
<element name="visibilityDisabled" type="select" selector="select[name='product[visibility]'][disabled=true]"/>
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
<element name="setProductAsNewFrom" type="input" selector="input[name='product[news_from_date]']"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testGetList()

$collection = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock();
$collection->expects($this->once())->method('getSize')->willReturn($totalCount);
$collection->expects($this->once())->method('getItems')->willReturn([$categoryFirst, $categorySecond]);
$collection->expects($this->once())->method('getAllIds')->willReturn([$categoryIdFirst, $categoryIdSecond]);

$this->collectionProcessorMock->expects($this->once())
->method('process')
Expand Down
27 changes: 2 additions & 25 deletions app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Magento\CatalogGraphQl\Model\Resolver;

use Magento\Framework\Exception\InputException;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Filter;
use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search;
Expand All @@ -17,7 +16,6 @@
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\SearchFilter;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\Framework\Api\Search\SearchCriteriaInterface;

/**
* Products field resolver, used for GraphQL request processing.
Expand Down Expand Up @@ -82,10 +80,10 @@ public function resolve(
} elseif (isset($args['search'])) {
$layerType = Resolver::CATALOG_LAYER_SEARCH;
$this->searchFilter->add($args['search'], $searchCriteria);
$searchResult = $this->getSearchResult($this->searchQuery, $searchCriteria, $info);
$searchResult = $this->searchQuery->getResult($searchCriteria, $info);
} else {
$layerType = Resolver::CATALOG_LAYER_CATEGORY;
$searchResult = $this->getSearchResult($this->filterQuery, $searchCriteria, $info);
$searchResult = $this->filterQuery->getResult($searchCriteria, $info);
}
//possible division by 0
if ($searchCriteria->getPageSize()) {
Expand Down Expand Up @@ -117,25 +115,4 @@ public function resolve(

return $data;
}

/**
* Get search result.
*
* @param Filter|Search $query
* @param SearchCriteriaInterface $searchCriteria
* @param ResolveInfo $info
*
* @return \Magento\CatalogGraphQl\Model\Resolver\Products\SearchResult
* @throws GraphQlInputException
*/
private function getSearchResult($query, SearchCriteriaInterface $searchCriteria, ResolveInfo $info)
{
try {
$searchResult = $query->getResult($searchCriteria, $info);
} catch (InputException $e) {
throw new GraphQlInputException(__($e->getMessage()));
}

return $searchResult;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@
<click selector="{{StoreFrontRemoveItemModalSection.ok}}" stepKey="confirmDelete"/>
<waitForPageLoad stepKey="waitForDeleteToFinish"/>
</actionGroup>

<!--Check that the minicart is empty-->
<actionGroup name="assertMiniCartEmpty">
<dontSeeElement selector="{{StorefrontMinicartSection.productCount}}" stepKey="dontSeeMinicartProductCount"/>
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="expandMinicart"/>
<see selector="{{StorefrontMinicartSection.minicartContent}}" userInput="You have no items in your shopping cart." stepKey="seeEmptyCartMessage"/>
</actionGroup>
</actionGroups>
25 changes: 15 additions & 10 deletions app/code/Magento/Config/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,24 +525,29 @@ public function setDataByPath($path, $value)
if ($path === '') {
throw new \UnexpectedValueException('Path must not be empty');
}

$pathParts = explode('/', $path);
$keyDepth = count($pathParts);
if ($keyDepth !== 3) {
if ($keyDepth < 3) {
throw new \UnexpectedValueException(
"Allowed depth of configuration is 3 (<section>/<group>/<field>). Your configuration depth is "
. $keyDepth . " for path '$path'"
'Minimal depth of configuration is 3. Your configuration depth is ' . $keyDepth
);
}

$section = array_shift($pathParts);
$data = [
'section' => $pathParts[0],
'groups' => [
$pathParts[1] => [
'fields' => [
$pathParts[2] => ['value' => $value],
],
],
'fields' => [
array_pop($pathParts) => ['value' => $value],
],
];
while ($pathParts) {
$data = [
'groups' => [
array_pop($pathParts) => $data,
],
];
}
$data['section'] = $section;
$this->addData($data);
}

Expand Down
74 changes: 54 additions & 20 deletions app/code/Magento/Config/Test/Unit/Model/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,59 @@ public function testSaveToCheckScopeDataSet()
$this->model->save();
}

public function testSetDataByPath()
/**
* @param string $path
* @param string $value
* @param string $section
* @param array $groups
* @dataProvider setDataByPathDataProvider
*/
public function testSetDataByPath(string $path, string $value, string $section, array $groups)
{
$value = 'value';
$path = '<section>/<group>/<field>';
$this->model->setDataByPath($path, $value);
$expected = [
'section' => '<section>',
'groups' => [
'<group>' => [
'fields' => [
'<field>' => ['value' => $value],
$this->assertEquals($section, $this->model->getData('section'));
$this->assertEquals($groups, $this->model->getData('groups'));
}

/**
* @return array
*/
public function setDataByPathDataProvider(): array
{
return [
'depth 3' => [
'a/b/c',
'value1',
'a',
[
'b' => [
'fields' => [
'c' => ['value' => 'value1'],
],
],
],
],
'depth 5' => [
'a/b/c/d/e',
'value1',
'a',
[
'b' => [
'groups' => [
'c' => [
'groups' => [
'd' => [
'fields' => [
'e' => ['value' => 'value1'],
],
],
],
],
],
],
],
],
];
$this->assertSame($expected, $this->model->getData());
}

/**
Expand All @@ -359,14 +396,13 @@ public function testSetDataByPathEmpty()

/**
* @param string $path
* @param string $expectedException
*
* @dataProvider setDataByPathWrongDepthDataProvider
*/
public function testSetDataByPathWrongDepth($path, $expectedException)
public function testSetDataByPathWrongDepth(string $path)
{
$expectedException = 'Allowed depth of configuration is 3 (<section>/<group>/<field>). ' . $expectedException;
$this->expectException('\UnexpectedValueException');
$currentDepth = count(explode('/', $path));
$expectedException = 'Minimal depth of configuration is 3. Your configuration depth is ' . $currentDepth;
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessage($expectedException);
$value = 'value';
$this->model->setDataByPath($path, $value);
Expand All @@ -375,13 +411,11 @@ public function testSetDataByPathWrongDepth($path, $expectedException)
/**
* @return array
*/
public function setDataByPathWrongDepthDataProvider()
public function setDataByPathWrongDepthDataProvider(): array
{
return [
'depth 2' => ['section/group', "Your configuration depth is 2 for path 'section/group'"],
'depth 1' => ['section', "Your configuration depth is 1 for path 'section'"],
'depth 4' => ['section/group/field/sub-field', "Your configuration depth is 4 for path"
. " 'section/group/field/sub-field'", ],
'depth 2' => ['section/group'],
'depth 1' => ['section'],
];
}
}
5 changes: 4 additions & 1 deletion app/code/Magento/ConfigurableImportExport/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_ConfigurableImportExport" >
<module name="Magento_ConfigurableImportExport">
<sequence>
<module name="Magento_ConfigurableProduct"/>
</sequence>
</module>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ define([

return Abstract.extend({
defaults: {
listens: {
isConfigurable: 'handlePriceValue'
},
imports: {
isConfigurable: '!ns = ${ $.ns }, index = configurable-matrix:isEmpty'
},
Expand All @@ -22,12 +19,15 @@ define([
}
},

/**
* Invokes initialize method of parent class,
* contains initialization logic
*/
/** @inheritdoc */
initialize: function () {
this._super();
// resolve initial disable state
this.handlePriceValue(this.isConfigurable);
// add listener to track "configurable" type
this.setListeners({
isConfigurable: 'handlePriceValue'
});

return this;
},
Expand All @@ -50,11 +50,10 @@ define([
* @param {String} isConfigurable
*/
handlePriceValue: function (isConfigurable) {
this.disabled(!!this.isUseDefault() || isConfigurable);

if (isConfigurable) {
this.disable();
this.clear();
} else {
this.enable();
}
}
});
Expand Down
Loading

0 comments on commit 9d231d1

Please sign in to comment.