Skip to content

Commit d6a6d99

Browse files
merge magento/2.3-develop into magento-chaika/Chaika-PR-2019-09-03-2.3
2 parents feada59 + 004da75 commit d6a6d99

File tree

93 files changed

+2632
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2632
-427
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ class AdvancedPricing extends \Magento\ImportExport\Model\Import\Entity\Abstract
5050

5151
const VALIDATOR_WEBSITE = 'validator_website';
5252

53-
const VALIDATOR_TEAR_PRICE = 'validator_tear_price';
53+
/**
54+
* @deprecated
55+
* @see VALIDATOR_TIER_PRICE
56+
*/
57+
private const VALIDATOR_TEAR_PRICE = 'validator_tier_price';
58+
59+
private const VALIDATOR_TIER_PRICE = 'validator_tier_price';
5460

5561
/**
5662
* Validation failure message template definitions.
@@ -221,7 +227,7 @@ public function __construct(
221227
$this->_catalogProductEntity = $this->_resourceFactory->create()->getTable('catalog_product_entity');
222228
$this->_oldSkus = $this->retrieveOldSkus();
223229
$this->_validators[self::VALIDATOR_WEBSITE] = $websiteValidator;
224-
$this->_validators[self::VALIDATOR_TEAR_PRICE] = $tierPriceValidator;
230+
$this->_validators[self::VALIDATOR_TIER_PRICE] = $tierPriceValidator;
225231
$this->errorAggregator = $errorAggregator;
226232

227233
foreach (array_merge($this->errorMessageTemplates, $this->_messageTemplates) as $errorCode => $message) {
@@ -536,7 +542,7 @@ protected function getWebSiteId($websiteCode)
536542
*/
537543
protected function getCustomerGroupId($customerGroup)
538544
{
539-
$customerGroups = $this->_getValidator(self::VALIDATOR_TEAR_PRICE)->getCustomerGroups();
545+
$customerGroups = $this->_getValidator(self::VALIDATOR_TIER_PRICE)->getCustomerGroups();
540546
return $customerGroup == self::VALUE_ALL_GROUPS ? 0 : $customerGroups[$customerGroup];
541547
}
542548

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\AbstractImportTestCase
1717
{
18+
/**
19+
* DB Table data
20+
*/
1821
const TABLE_NAME = 'tableName';
1922
const LINK_FIELD = 'linkField';
2023

@@ -54,7 +57,7 @@ class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\A
5457
protected $websiteValidator;
5558

5659
/**
57-
* @var AdvancedPricing\Validator\TearPrice |\PHPUnit_Framework_MockObject_MockObject
60+
* @var AdvancedPricing\Validator\TierPrice |\PHPUnit_Framework_MockObject_MockObject
5861
*/
5962
protected $tierPriceValidator;
6063

app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
1111
use Magento\Framework\Stdlib\ArrayManager;
12+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1213

1314
/**
1415
* SetPaymentMethod additional data provider model for Authorizenet payment method
@@ -36,10 +37,32 @@ public function __construct(
3637
*
3738
* @param array $data
3839
* @return array
40+
* @throws GraphQlInputException
3941
*/
4042
public function getData(array $data): array
4143
{
42-
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data) ?? [];
44+
if (!isset($data[self::PATH_ADDITIONAL_DATA])) {
45+
throw new GraphQlInputException(
46+
__('Required parameter "authorizenet_acceptjs" for "payment_method" is missing.')
47+
);
48+
}
49+
if (!isset($data[self::PATH_ADDITIONAL_DATA]['opaque_data_descriptor'])) {
50+
throw new GraphQlInputException(
51+
__('Required parameter "opaque_data_descriptor" for "authorizenet_acceptjs" is missing.')
52+
);
53+
}
54+
if (!isset($data[self::PATH_ADDITIONAL_DATA]['opaque_data_value'])) {
55+
throw new GraphQlInputException(
56+
__('Required parameter "opaque_data_value" for "authorizenet_acceptjs" is missing.')
57+
);
58+
}
59+
if (!isset($data[self::PATH_ADDITIONAL_DATA]['cc_last_4'])) {
60+
throw new GraphQlInputException(
61+
__('Required parameter "cc_last_4" for "authorizenet_acceptjs" is missing.')
62+
);
63+
}
64+
65+
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data);
4366
foreach ($additionalData as $key => $value) {
4467
$additionalData[$this->convertSnakeCaseToCamelCase($key)] = $value;
4568
unset($additionalData[$key]);

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePrice.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public function __construct(
3939
$this->locator = $locator;
4040
$this->arrayManager = $arrayManager;
4141
}
42-
42+
4343
/**
44-
* {@inheritdoc}
44+
* @inheritdoc
4545
*/
4646
public function modifyMeta(array $meta)
4747
{
@@ -64,7 +64,7 @@ public function modifyMeta(array $meta)
6464
$this->arrayManager->findPath(
6565
ProductAttributeInterface::CODE_PRICE,
6666
$meta,
67-
null,
67+
self::DEFAULT_GENERAL_PANEL . '/children',
6868
'children'
6969
) . static::META_CONFIG_PATH,
7070
$meta,
@@ -94,7 +94,7 @@ public function modifyMeta(array $meta)
9494
}
9595

9696
/**
97-
* {@inheritdoc}
97+
* @inheritdoc
9898
*/
9999
public function modifyData(array $data)
100100
{

app/code/Magento/Catalog/Block/Product/View/Details.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ public function getGroupSortedChildNames(string $groupName, string $callback): a
3737
$alias = $layout->getElementAlias($childName);
3838
$sortOrder = (int)$this->getChildData($alias, 'sort_order') ?? 0;
3939

40-
$childNamesSortOrder[$sortOrder] = $childName;
40+
$childNamesSortOrder[$childName] = $sortOrder;
4141
}
4242

43-
ksort($childNamesSortOrder, SORT_NUMERIC);
43+
asort($childNamesSortOrder, SORT_NUMERIC);
4444

45-
return $childNamesSortOrder;
45+
return array_keys($childNamesSortOrder);
4646
}
4747
}

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function getChildFinalPrice($product, $productQty, $childProduct, $childP
204204
}
205205

206206
/**
207-
* Gets the 'tear_price' array from the product
207+
* Gets the 'tier_price' array from the product
208208
*
209209
* @param Product $product
210210
* @param string $key

app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/GroupPrice/AbstractTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public function testGetAffectedFields()
6565
$attribute->expects($this->any())->method('getAttributeId')->will($this->returnValue($attributeId));
6666
$attribute->expects($this->any())->method('isStatic')->will($this->returnValue(false));
6767
$attribute->expects($this->any())->method('getBackendTable')->will($this->returnValue('table'));
68-
$attribute->expects($this->any())->method('getName')->will($this->returnValue('tear_price'));
68+
$attribute->expects($this->any())->method('getName')->will($this->returnValue('tier_price'));
6969
$this->_model->setAttribute($attribute);
7070

7171
$object = new \Magento\Framework\DataObject();
72-
$object->setTearPrice([['price_id' => 10]]);
72+
$object->setTierPrice([['price_id' => 10]]);
7373
$object->setId(555);
7474

7575
$this->assertEquals(

app/code/Magento/Catalog/Test/Unit/Pricing/Price/BasePriceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BasePriceTest extends \PHPUnit\Framework\TestCase
3939
/**
4040
* @var \Magento\Catalog\Pricing\Price\TierPrice|\PHPUnit_Framework_MockObject_MockObject
4141
*/
42-
protected $tearPriceMock;
42+
protected $tierPriceMock;
4343

4444
/**
4545
* @var \Magento\Catalog\Pricing\Price\SpecialPrice|\PHPUnit_Framework_MockObject_MockObject
@@ -60,7 +60,7 @@ protected function setUp()
6060
$this->saleableItemMock = $this->createMock(\Magento\Catalog\Model\Product::class);
6161
$this->priceInfoMock = $this->createMock(\Magento\Framework\Pricing\PriceInfo\Base::class);
6262
$this->regularPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\RegularPrice::class);
63-
$this->tearPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\TierPrice::class);
63+
$this->tierPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\TierPrice::class);
6464
$this->specialPriceMock = $this->createMock(\Magento\Catalog\Pricing\Price\SpecialPrice::class);
6565
$this->calculatorMock = $this->createMock(\Magento\Framework\Pricing\Adjustment\Calculator::class);
6666

@@ -69,7 +69,7 @@ protected function setUp()
6969
->will($this->returnValue($this->priceInfoMock));
7070
$this->prices = [
7171
'regular_price' => $this->regularPriceMock,
72-
'tear_price' => $this->tearPriceMock,
72+
'tier_price' => $this->tierPriceMock,
7373
'special_price' => $this->specialPriceMock,
7474
];
7575

@@ -97,7 +97,7 @@ public function testGetValue($specialPriceValue, $expectedResult)
9797
$this->regularPriceMock->expects($this->exactly(3))
9898
->method('getValue')
9999
->will($this->returnValue(100));
100-
$this->tearPriceMock->expects($this->exactly(2))
100+
$this->tierPriceMock->expects($this->exactly(2))
101101
->method('getValue')
102102
->will($this->returnValue(99));
103103
$this->specialPriceMock->expects($this->any())

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoryTree.php

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
use Magento\Catalog\Model\Category;
1111
use Magento\CatalogGraphQl\Model\Resolver\Category\CheckCategoryIsActive;
1212
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\ExtractDataFromCategoryTree;
13-
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1413
use Magento\Framework\GraphQl\Config\Element\Field;
15-
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1614
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
1715
use Magento\Framework\GraphQl\Query\ResolverInterface;
16+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
17+
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\CategoryTree as CategoryTreeDataProvider;
1818

1919
/**
2020
* Category tree field resolver, used for GraphQL request processing.
@@ -27,7 +27,7 @@ class CategoryTree implements ResolverInterface
2727
const CATEGORY_INTERFACE = 'CategoryInterface';
2828

2929
/**
30-
* @var \Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\CategoryTree
30+
* @var CategoryTreeDataProvider
3131
*/
3232
private $categoryTree;
3333

@@ -42,12 +42,12 @@ class CategoryTree implements ResolverInterface
4242
private $checkCategoryIsActive;
4343

4444
/**
45-
* @param \Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\CategoryTree $categoryTree
45+
* @param CategoryTreeDataProvider $categoryTree
4646
* @param ExtractDataFromCategoryTree $extractDataFromCategoryTree
4747
* @param CheckCategoryIsActive $checkCategoryIsActive
4848
*/
4949
public function __construct(
50-
\Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\CategoryTree $categoryTree,
50+
CategoryTreeDataProvider $categoryTree,
5151
ExtractDataFromCategoryTree $extractDataFromCategoryTree,
5252
CheckCategoryIsActive $checkCategoryIsActive
5353
) {
@@ -56,22 +56,6 @@ public function __construct(
5656
$this->checkCategoryIsActive = $checkCategoryIsActive;
5757
}
5858

59-
/**
60-
* Get category id
61-
*
62-
* @param array $args
63-
* @return int
64-
* @throws GraphQlInputException
65-
*/
66-
private function getCategoryId(array $args) : int
67-
{
68-
if (!isset($args['id'])) {
69-
throw new GraphQlInputException(__('"id for category should be specified'));
70-
}
71-
72-
return (int)$args['id'];
73-
}
74-
7559
/**
7660
* @inheritdoc
7761
*/
@@ -81,7 +65,9 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8165
return $value[$field->getName()];
8266
}
8367

84-
$rootCategoryId = $this->getCategoryId($args);
68+
$rootCategoryId = isset($args['id']) ? (int)$args['id'] :
69+
(int)$context->getExtensionAttributes()->getStore()->getRootCategoryId();
70+
8571
if ($rootCategoryId !== Category::TREE_ROOT_ID) {
8672
$this->checkCategoryIsActive->execute($rootCategoryId);
8773
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogGraphQl\Model\Resolver;
9+
10+
use Magento\Framework\GraphQl\Config\Element\Field;
11+
use Magento\Framework\GraphQl\Query\ResolverInterface;
12+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
13+
14+
/**
15+
* Root category tree field resolver, used for GraphQL request processing.
16+
*/
17+
class RootCategoryId implements ResolverInterface
18+
{
19+
/**
20+
* @inheritdoc
21+
*/
22+
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
23+
{
24+
return (int)$context->getExtensionAttributes()->getStore()->getRootCategoryId();
25+
}
26+
}

0 commit comments

Comments
 (0)