Skip to content

Commit cd9eafa

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-72625
2 parents d0b7560 + 8e17718 commit cd9eafa

File tree

25 files changed

+2223
-18
lines changed

25 files changed

+2223
-18
lines changed

app/code/Magento/Catalog/Console/Command/ImagesResizeCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ protected function execute(
6969
$productIds = $productCollection->getAllIds();
7070
if (!count($productIds)) {
7171
$output->writeln("<info>No product images to resize</info>");
72-
// we must have an exit code higher than zero to indicate something was wrong
7372
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
7473
}
7574

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getDefaultStoreId()
140140
*
141141
* @param string $table
142142
* @param array|int $attributeIds
143-
* @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
143+
* @return \Magento\Framework\DB\Select
144144
*/
145145
protected function _getLoadAttributesSelect($table, $attributeIds = [])
146146
{

app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ public function _loadEntities($printQuery = false, $logQuery = false)
11241124
$query = $this->getSelect();
11251125
$rows = $this->_fetchAll($query);
11261126
} catch (\Exception $e) {
1127-
$this->printLogQuery(true, true, $query);
1127+
$this->printLogQuery(false, true, $query);
11281128
throw $e;
11291129
}
11301130

app/code/Magento/Quote/Observer/Webapi/SubmitObserver.php renamed to app/code/Magento/Quote/Observer/SubmitObserver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Quote\Observer\Webapi;
6+
namespace Magento\Quote\Observer;
77

88
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
99
use Magento\Framework\Event\ObserverInterface;
@@ -13,12 +13,12 @@ class SubmitObserver implements ObserverInterface
1313
/**
1414
* @var \Psr\Log\LoggerInterface
1515
*/
16-
protected $logger;
16+
private $logger;
1717

1818
/**
1919
* @var OrderSender
2020
*/
21-
protected $orderSender;
21+
private $orderSender;
2222

2323
/**
2424
* @param \Psr\Log\LoggerInterface $logger

app/code/Magento/Quote/Test/Unit/Observer/Webapi/SubmitObserverTest.php renamed to app/code/Magento/Quote/Test/Unit/Observer/SubmitObserverTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Quote\Test\Unit\Observer\Webapi;
6+
namespace Magento\Quote\Test\Unit\Observer;
77

88
class SubmitObserverTest extends \PHPUnit\Framework\TestCase
99
{
1010
/**
11-
* @var \Magento\Quote\Observer\Webapi\SubmitObserver
11+
* @var \Magento\Quote\Observer\SubmitObserver
1212
*/
1313
protected $model;
1414

@@ -59,7 +59,7 @@ protected function setUp()
5959
$eventMock->expects($this->once())->method('getQuote')->willReturn($this->quoteMock);
6060
$eventMock->expects($this->once())->method('getOrder')->willReturn($this->orderMock);
6161
$this->quoteMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock);
62-
$this->model = new \Magento\Quote\Observer\Webapi\SubmitObserver(
62+
$this->model = new \Magento\Quote\Observer\SubmitObserver(
6363
$this->loggerMock,
6464
$this->orderSenderMock
6565
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
9+
<event name="sales_model_service_quote_submit_success">
10+
<observer name="sendEmail" instance="Magento\Quote\Observer\SubmitObserver" />
11+
</event>
12+
</config>

app/code/Magento/Quote/etc/webapi_rest/events.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
99
<event name="sales_model_service_quote_submit_success">
10-
<observer name="sendEmail" instance="Magento\Quote\Observer\Webapi\SubmitObserver" />
10+
<observer name="sendEmail" instance="Magento\Quote\Observer\SubmitObserver" />
1111
</event>
1212
</config>

app/code/Magento/Quote/etc/webapi_soap/events.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
99
<event name="sales_model_service_quote_submit_success">
10-
<observer name="sendEmail" instance="Magento\Quote\Observer\Webapi\SubmitObserver" />
10+
<observer name="sendEmail" instance="Magento\Quote\Observer\SubmitObserver" />
1111
</event>
1212
</config>

app/code/Magento/Sales/Block/Order/Totals.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ public function removeTotal($code)
293293
*/
294294
public function applySortOrder($order)
295295
{
296+
\uksort(
297+
$this->_totals,
298+
function ($code1, $code2) use ($order) {
299+
return ($order[$code1] ?? 0) <=> ($order[$code2] ?? 0);
300+
}
301+
);
296302
return $this;
297303
}
298304

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Test\Unit\Block\Order;
7+
8+
use Magento\Framework\Registry;
9+
use Magento\Sales\Block\Order\Totals;
10+
use Magento\Sales\Model\Order;
11+
use Magento\Sales\Model\Order\Total;
12+
13+
class TotalsTest extends \PHPUnit\Framework\TestCase
14+
{
15+
/**
16+
* @var \Magento\Sales\Block\Order\Totals
17+
*/
18+
protected $block;
19+
20+
/**
21+
* @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
protected $context;
24+
25+
protected function setUp()
26+
{
27+
$this->context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
28+
$this->block = new Totals($this->context, new Registry);
29+
$this->block->setOrder($this->createMock(Order::class));
30+
}
31+
32+
public function testApplySortOrder()
33+
{
34+
$this->block->addTotal(new Total(['code' => 'one']), 'last');
35+
$this->block->addTotal(new Total(['code' => 'two']), 'last');
36+
$this->block->addTotal(new Total(['code' => 'three']), 'last');
37+
$this->block->applySortOrder(
38+
[
39+
'one' => 10,
40+
'two' => 30,
41+
'three' => 20,
42+
]
43+
);
44+
$this->assertEqualsSorted(
45+
[
46+
'one' => new Total(['code' => 'one']),
47+
'three' => new Total(['code' => 'three']),
48+
'two' => new Total(['code' => 'two']),
49+
],
50+
$this->block->getTotals()
51+
);
52+
}
53+
54+
private function assertEqualsSorted(array $expected, array $actual)
55+
{
56+
$this->assertEquals($expected, $actual, 'Array contents should be equal.');
57+
$this->assertEquals(array_keys($expected), array_keys($actual), 'Array sort order should be equal.');
58+
}
59+
}

0 commit comments

Comments
 (0)