Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 39317f7

Browse files
author
Magento CICD
authored
merge magento/2.3-develop into magento-tsg-csl3/2.3-develop-pr10
2 parents ae788d7 + 5916c5a commit 39317f7

File tree

20 files changed

+583
-52
lines changed

20 files changed

+583
-52
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
77

88
## Magento system requirements
9-
[Magento system requirements](http://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
9+
[Magento system requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
1010

1111
## Install Magento
1212

13-
* [Installation guide](http://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
13+
* [Installation guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
1414

1515
<h2>Contributing to the Magento 2 code base</h2>
1616
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
@@ -21,10 +21,10 @@ To learn about issues, click [here][2]. To open an issue, click [here][3].
2121

2222
To suggest documentation improvements, click [here][4].
2323

24-
[1]: <http://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html>
25-
[2]: <http://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#report>
24+
[1]: <https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html>
25+
[2]: <https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#report>
2626
[3]: <https://github.com/magento/magento2/issues>
27-
[4]: <http://devdocs.magento.com>
27+
[4]: <https://devdocs.magento.com>
2828

2929
<h3>Community Maintainers</h3>
3030
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks these Community Maintainers for their valuable contributions.
@@ -53,9 +53,9 @@ Stay up-to-date on the latest security news and patches for Magento by signing u
5353

5454
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license.
5555

56-
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
57-
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact [email protected] for a copy.
56+
[Open Software License (OSL 3.0)](https://opensource.org/licenses/osl-3.0.php).
57+
Please see [LICENSE.txt](https://github.com/magento/magento2/blob/2.3-develop/LICENSE.txt) for the full text of the OSL 3.0 license or contact [email protected] for a copy.
5858

5959
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
60-
Please see LICENSE_EE.txt for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.
60+
Please see LICENSE_EE.txt for the full text of the MEE License or visit https://magento.com/legal/terms/enterprise.
6161

app/code/Magento/AdminNotification/Block/Window.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\AdminNotification\Block;
99

1010
/**
11+
* Admin notification window block
12+
*
1113
* @api
1214
* @since 100.0.2
1315
*/
@@ -40,7 +42,7 @@ class Window extends \Magento\Backend\Block\Template
4042
protected $_criticalCollection;
4143

4244
/**
43-
* @var \Magento\Adminnotification\Model\Inbox
45+
* @var \Magento\AdminNotification\Model\Inbox
4446
*/
4547
protected $_latestItem;
4648

@@ -92,7 +94,7 @@ protected function _toHtml()
9294
/**
9395
* Retrieve latest critical item
9496
*
95-
* @return bool|\Magento\Adminnotification\Model\Inbox
97+
* @return bool|\Magento\AdminNotification\Model\Inbox
9698
*/
9799
protected function _getLatestItem()
98100
{

app/code/Magento/Braintree/Controller/Paypal/Review.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
use Magento\Braintree\Gateway\Config\PayPal\Config;
1313
use Magento\Braintree\Model\Paypal\Helper\QuoteUpdater;
1414
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\App\Action\HttpPostActionInterface;
1516

1617
/**
1718
* Class Review
1819
*/
19-
class Review extends AbstractAction
20+
class Review extends AbstractAction implements HttpPostActionInterface
2021
{
2122
/**
2223
* @var QuoteUpdater
@@ -60,7 +61,7 @@ public function execute()
6061
try {
6162
$this->validateQuote($quote);
6263

63-
if ($this->validateRequestData($requestData)) {
64+
if ($requestData && $this->validateRequestData($requestData)) {
6465
$this->quoteUpdater->execute(
6566
$requestData['nonce'],
6667
$requestData['details'],
@@ -91,6 +92,8 @@ public function execute()
9192
}
9293

9394
/**
95+
* Validate request data
96+
*
9497
* @param array $requestData
9598
* @return boolean
9699
*/

app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,8 @@ protected function _getSpecificTypeData(array $rowData, $optionTypeId, $defaultS
17941794
];
17951795

17961796
$priceData = false;
1797-
if (!empty($rowData[self::COLUMN_ROW_PRICE])) {
1797+
$customOptionRowPrice = $rowData[self::COLUMN_ROW_PRICE];
1798+
if (!empty($customOptionRowPrice) || $customOptionRowPrice === '0') {
17981799
$priceData = [
17991800
'price' => (double)rtrim($rowData[self::COLUMN_ROW_PRICE], '%'),
18001801
'price_type' => 'fixed',

app/code/Magento/Checkout/Model/Cart.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ public function addProduct($productInfo, $requestInfo = null)
380380
}
381381

382382
try {
383+
$this->_eventManager->dispatch(
384+
'checkout_cart_product_add_before',
385+
['info' => $requestInfo, 'product' => $product]
386+
);
383387
$result = $this->getQuote()->addProduct($product, $request);
384388
} catch (\Magento\Framework\Exception\LocalizedException $e) {
385389
$this->_checkoutSession->setUseNotice(false);
@@ -615,6 +619,8 @@ public function truncate()
615619
}
616620

617621
/**
622+
* Get product ids.
623+
*
618624
* @return int[]
619625
*/
620626
public function getProductIds()

app/code/Magento/Checkout/Test/Unit/Model/CartTest.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,20 @@ public function testAddProduct($productInfo, $requestInfo)
318318
$this->productRepository->expects($this->any())
319319
->method('getById')
320320
->will($this->returnValue($product));
321+
322+
$this->eventManagerMock->expects($this->at(0))->method('dispatch')->with(
323+
'checkout_cart_product_add_before',
324+
['info' => $requestInfo, 'product' => $product]
325+
);
326+
321327
$this->quoteMock->expects($this->once())
322328
->method('addProduct')
323329
->will($this->returnValue(1));
324330
$this->checkoutSessionMock->expects($this->once())
325331
->method('getQuote')
326332
->will($this->returnValue($this->quoteMock));
327333

328-
$this->eventManagerMock->expects($this->at(0))->method('dispatch')->with(
334+
$this->eventManagerMock->expects($this->at(1))->method('dispatch')->with(
329335
'checkout_cart_product_add_after',
330336
['quote_item' => 1, 'product' => $product]
331337
);
@@ -363,17 +369,19 @@ public function testAddProductException()
363369
$this->productRepository->expects($this->any())
364370
->method('getById')
365371
->will($this->returnValue($product));
372+
373+
$this->eventManagerMock->expects($this->once())->method('dispatch')->with(
374+
'checkout_cart_product_add_before',
375+
['info' => 4, 'product' => $product]
376+
);
377+
366378
$this->quoteMock->expects($this->once())
367379
->method('addProduct')
368380
->will($this->returnValue('error'));
369381
$this->checkoutSessionMock->expects($this->once())
370382
->method('getQuote')
371383
->will($this->returnValue($this->quoteMock));
372384

373-
$this->eventManagerMock->expects($this->never())->method('dispatch')->with(
374-
'checkout_cart_product_add_after',
375-
['quote_item' => 1, 'product' => $product]
376-
);
377385
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
378386
$this->cart->addProduct(4, 4);
379387
}
@@ -399,6 +407,11 @@ public function testAddProductExceptionBadParams()
399407
->method('getById')
400408
->will($this->returnValue($product));
401409

410+
$this->eventManagerMock->expects($this->never())->method('dispatch')->with(
411+
'checkout_cart_product_add_before',
412+
['info' => 'bad', 'product' => $product]
413+
);
414+
402415
$this->eventManagerMock->expects($this->never())->method('dispatch')->with(
403416
'checkout_cart_product_add_after',
404417
['quote_item' => 1, 'product' => $product]

app/code/Magento/Customer/Model/GroupManagement.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Magento\Framework\Api\SortOrderBuilder;
1616
use Magento\Framework\App\Config\ScopeConfigInterface;
1717
use Magento\Framework\App\ObjectManager;
18-
use Magento\Framework\Data\Collection;
1918
use Magento\Framework\Exception\NoSuchEntityException;
2019
use Magento\Store\Model\StoreManagerInterface;
2120

@@ -170,7 +169,7 @@ public function getLoggedInGroups()
170169
->create();
171170
$groupNameSortOrder = $this->sortOrderBuilder
172171
->setField('customer_group_code')
173-
->setDirection(Collection::SORT_ORDER_ASC)
172+
->setAscendingDirection()
174173
->create();
175174
$searchCriteria = $this->searchCriteriaBuilder
176175
->addFilters($notLoggedInFilter)

app/code/Magento/Deploy/Console/DeployStaticOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private function getBasicOptions()
240240
new InputArgument(
241241
self::LANGUAGES_ARGUMENT,
242242
InputArgument::IS_ARRAY,
243-
'Space-separated list of ISO-636 language codes for which to output static view files.'
243+
'Space-separated list of ISO-639 language codes for which to output static view files.'
244244
),
245245
];
246246
}
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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\Elasticsearch\Test\Unit\Observer;
9+
10+
use Magento\CatalogSearch\Model\Indexer\Fulltext\Processor;
11+
use Magento\Elasticsearch\Model\Config;
12+
use Magento\Elasticsearch\Observer\CategoryProductIndexer;
13+
use Magento\Framework\Event;
14+
use Magento\Framework\Event\Observer;
15+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
16+
17+
/**
18+
* Class CategoryProductIndexerTest
19+
*/
20+
class CategoryProductIndexerTest extends \PHPUnit\Framework\TestCase
21+
{
22+
/**
23+
* @var CategoryProductIndexer
24+
*/
25+
private $observer;
26+
27+
/**
28+
* @var Config|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $configMock;
31+
32+
/**
33+
* @var Processor|\PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
private $processorMock;
36+
37+
/**
38+
* @var Observer|\PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
private $observerMock;
41+
42+
/**
43+
* Set Up method
44+
*
45+
* @return void
46+
*/
47+
protected function setUp(): void
48+
{
49+
$this->configMock = $this->createMock(Config::class);
50+
$this->processorMock = $this->createMock(Processor::class);
51+
$this->observerMock = $this->createMock(Observer::class);
52+
53+
$objectManager = new ObjectManagerHelper($this);
54+
$this->observer = $objectManager->getObject(
55+
CategoryProductIndexer::class,
56+
[
57+
'config' => $this->configMock,
58+
'processor' => $this->processorMock,
59+
]
60+
);
61+
}
62+
63+
/**
64+
* Test if a category has changed products
65+
*
66+
* @return void
67+
*/
68+
public function testExecuteIfCategoryHasChangedProducts()
69+
{
70+
$this->getProductIdsWithEnabledElasticSearch();
71+
$this->processorMock->expects($this->once())->method('isIndexerScheduled')->willReturn(true);
72+
$this->processorMock->expects($this->once())->method('markIndexerAsInvalid');
73+
$this->observer->execute($this->observerMock);
74+
}
75+
76+
/**
77+
* Test if a category has changed products and not scheduled indexer
78+
*
79+
* @return void
80+
*/
81+
public function testExecuteIfCategoryHasChangedProductsAndNotScheduledIndexer(): void
82+
{
83+
$this->getProductIdsWithEnabledElasticSearch();
84+
$this->processorMock->expects($this->once())->method('isIndexerScheduled')->willReturn(false);
85+
$this->processorMock->expects($this->never())->method('markIndexerAsInvalid');
86+
$this->observer->execute($this->observerMock);
87+
}
88+
89+
/**
90+
* Test if a category has none changed products
91+
*
92+
* @return void
93+
*/
94+
public function testExecuteIfCategoryHasNoneChangedProducts(): void
95+
{
96+
/** @var Event|\PHPUnit_Framework_MockObject_MockObject $eventMock */
97+
$eventMock = $this->createPartialMock(Event::class, ['getProductIds']);
98+
$this->configMock->expects($this->once())->method('isElasticsearchEnabled')->willReturn(true);
99+
100+
$eventMock->expects($this->once())->method('getProductIds')->willReturn([]);
101+
$this->observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
102+
103+
$this->processorMock->expects($this->never())->method('isIndexerScheduled');
104+
$this->processorMock->expects($this->never())->method('markIndexerAsInvalid');
105+
106+
$this->observer->execute($this->observerMock);
107+
}
108+
109+
/**
110+
* Test if ElasticSearch is disabled
111+
*
112+
* @return void
113+
*/
114+
public function testExecuteIfElasticSearchIsDisabled(): void
115+
{
116+
/** @var Event|\PHPUnit_Framework_MockObject_MockObject $eventMock */
117+
$eventMock = $this->createPartialMock(Event::class, ['getProductIds']);
118+
$this->configMock->expects($this->once())->method('isElasticsearchEnabled')->willReturn(false);
119+
$eventMock->expects($this->never())->method('getProductIds')->willReturn([]);
120+
$this->observer->execute($this->observerMock);
121+
}
122+
123+
/**
124+
* Get product ids with enabled ElasticSearch
125+
*
126+
* @return void
127+
*/
128+
private function getProductIdsWithEnabledElasticSearch(): void
129+
{
130+
/** @var Event|\PHPUnit_Framework_MockObject_MockObject $eventMock */
131+
$eventMock = $this->createPartialMock(Event::class, ['getProductIds']);
132+
$this->configMock->expects($this->once())->method('isElasticsearchEnabled')->willReturn(true);
133+
$eventMock->expects($this->once())->method('getProductIds')->willReturn([1]);
134+
$this->observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
135+
}
136+
}

0 commit comments

Comments
 (0)