Skip to content

Commit a71039f

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into pr_2019_04_17
2 parents 20a4781 + 88eba25 commit a71039f

File tree

34 files changed

+339
-144
lines changed

34 files changed

+339
-144
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function setEntity($entity)
264264
$this->_entity = $this->_eavEntityFactory->create()->setType($entity);
265265
} else {
266266
throw new LocalizedException(
267-
__('The "%1" entity supplied is invalid. Verify the entity and try again.', print_r($entity, 1))
267+
__('The entity supplied to collection is invalid. Verify the entity and try again.')
268268
);
269269
}
270270
return $this;
@@ -1061,6 +1061,7 @@ public function importFromArray($arr)
10611061
$this->_items[$entityId]->addData($row);
10621062
}
10631063
}
1064+
$this->_setIsLoaded();
10641065
return $this;
10651066
}
10661067

@@ -1164,7 +1165,6 @@ public function _loadEntities($printQuery = false, $logQuery = false)
11641165
* @param bool $printQuery
11651166
* @param bool $logQuery
11661167
* @return $this
1167-
* @throws LocalizedException
11681168
* @throws \Exception
11691169
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
11701170
* @SuppressWarnings(PHPMD.NPathComplexity)

app/code/Magento/Integration/Model/AdminTokenService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct(
7272
}
7373

7474
/**
75-
* {@inheritdoc}
75+
* @inheritdoc
7676
*/
7777
public function createAdminAccessToken($username, $password)
7878
{
@@ -110,7 +110,7 @@ public function revokeAdminAccessToken($adminId)
110110
{
111111
$tokenCollection = $this->tokenModelCollectionFactory->create()->addFilterByAdminId($adminId);
112112
if ($tokenCollection->getSize() == 0) {
113-
throw new LocalizedException(__('This user has no tokens.'));
113+
return true;
114114
}
115115
try {
116116
foreach ($tokenCollection as $token) {

app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
use Magento\Integration\Model\Oauth\Token;
1010

11+
/**
12+
* Test for Magento\Integration\Model\AdminTokenService class.
13+
*/
1114
class AdminTokenServiceTest extends \PHPUnit\Framework\TestCase
1215
{
1316
/** \Magento\Integration\Model\AdminTokenService */
@@ -99,10 +102,6 @@ public function testRevokeAdminAccessToken()
99102
$this->assertTrue($this->_tokenService->revokeAdminAccessToken($adminId));
100103
}
101104

102-
/**
103-
* @expectedException \Magento\Framework\Exception\LocalizedException
104-
* @expectedExceptionMessage This user has no tokens.
105-
*/
106105
public function testRevokeAdminAccessTokenWithoutAdminId()
107106
{
108107
$this->_tokenModelCollectionMock->expects($this->once())

app/code/Magento/Msrp/Pricing/MsrpPriceCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MsrpPriceCalculator implements MsrpPriceCalculatorInterface
2323
/**
2424
* @param array $msrpPriceCalculators
2525
*/
26-
public function __construct(array $msrpPriceCalculators)
26+
public function __construct(array $msrpPriceCalculators = [])
2727
{
2828
$this->msrpPriceCalculators = $this->getMsrpPriceCalculators($msrpPriceCalculators);
2929
}

app/code/Magento/Review/Block/Adminhtml/Edit/Form.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
namespace Magento\Review\Block\Adminhtml\Edit;
8+
79
/**
810
* Adminhtml Review Edit Form
911
*/
10-
namespace Magento\Review\Block\Adminhtml\Edit;
11-
1212
class Form extends \Magento\Backend\Block\Widget\Form\Generic
1313
{
1414
/**
@@ -84,7 +84,8 @@ protected function _prepareForm()
8484
'review/*/save',
8585
[
8686
'id' => $this->getRequest()->getParam('id'),
87-
'ret' => $this->_coreRegistry->registry('ret')
87+
'ret' => $this->_coreRegistry->registry('ret'),
88+
'productId' => $this->getRequest()->getParam('productId')
8889
]
8990
),
9091
'method' => 'post',

app/code/Magento/Review/Controller/Adminhtml/Product/Save.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public function execute()
7373
} else {
7474
$resultRedirect->setPath('*/*/');
7575
}
76+
$productId = (int)$this->getRequest()->getParam('productId');
77+
if ($productId) {
78+
$resultRedirect->setPath("catalog/product/edit/id/$productId");
79+
}
7680
return $resultRedirect;
7781
}
7882
$resultRedirect->setPath('review/*/');

app/code/Magento/Sales/Model/Order/Payment.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function canCapture()
300300
}
301301

302302
/**
303-
* Check refund availability
303+
* Check refund availability.
304304
*
305305
* @return bool
306306
*/
@@ -310,7 +310,7 @@ public function canRefund()
310310
}
311311

312312
/**
313-
* Check partial refund availability for invoice
313+
* Check partial refund availability for invoice.
314314
*
315315
* @return bool
316316
*/
@@ -320,7 +320,7 @@ public function canRefundPartialPerInvoice()
320320
}
321321

322322
/**
323-
* Check partial capture availability
323+
* Check partial capture availability.
324324
*
325325
* @return bool
326326
*/
@@ -546,9 +546,7 @@ public function cancelInvoice($invoice)
546546
}
547547

548548
/**
549-
* Create new invoice with maximum qty for invoice for each item
550-
*
551-
* Register this invoice and capture
549+
* Create new invoice with maximum qty for invoice for each item register this invoice and capture
552550
*
553551
* @return Invoice
554552
*/
@@ -686,6 +684,7 @@ public function refund($creditmemo)
686684
$gateway->refund($this, $baseAmountToRefund);
687685

688686
$creditmemo->setTransactionId($this->getLastTransId());
687+
// phpcs:ignore Magento2.Exceptions.ThrowCatch
689688
} catch (\Magento\Framework\Exception\LocalizedException $e) {
690689
if (!$captureTxn) {
691690
throw new \Magento\Framework\Exception\LocalizedException(
@@ -732,10 +731,14 @@ public function refund($creditmemo)
732731
$message = $message = $this->prependMessage($message);
733732
$message = $this->_appendTransactionToMessage($transaction, $message);
734733
$orderState = $this->getOrderStateResolver()->getStateForOrder($this->getOrder());
734+
$statuses = $this->getOrder()->getConfig()->getStateStatuses($orderState, false);
735+
$status = in_array($this->getOrder()->getStatus(), $statuses, true)
736+
? $this->getOrder()->getStatus()
737+
: $this->getOrder()->getConfig()->getStateDefaultStatus($orderState);
735738
$this->getOrder()
736739
->addStatusHistoryComment(
737740
$message,
738-
$this->getOrder()->getConfig()->getStateDefaultStatus($orderState)
741+
$status
739742
)->setIsCustomerNotified($creditmemo->getOrder()->getCustomerNoteNotify());
740743
$this->_eventManager->dispatch(
741744
'sales_order_payment_refund',
@@ -1203,7 +1206,7 @@ public function addTransaction($type, $salesDocument = null, $failSafe = false)
12031206
}
12041207

12051208
/**
1206-
* Add message to the specified transaction.
1209+
* Add transaction comments to order.
12071210
*
12081211
* @param Transaction|null $transaction
12091212
* @param string $message

app/code/Magento/Sales/Model/RefundOrder.php

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

89
use Magento\Framework\App\ResourceConnection;
@@ -151,10 +152,13 @@ public function execute(
151152
$creditmemo->setState(\Magento\Sales\Model\Order\Creditmemo::STATE_REFUNDED);
152153
$order->setCustomerNoteNotify($notify);
153154
$order = $this->refundAdapter->refund($creditmemo, $order);
154-
$order->setState(
155-
$this->orderStateResolver->getStateForOrder($order, [])
156-
);
157-
$order->setStatus($this->config->getStateDefaultStatus($order->getState()));
155+
$orderState = $this->orderStateResolver->getStateForOrder($order, []);
156+
$order->setState($orderState);
157+
$statuses = $this->config->getStateStatuses($orderState, false);
158+
$status = in_array($order->getStatus(), $statuses, true)
159+
? $order->getStatus()
160+
: $this->config->getStateDefaultStatus($orderState);
161+
$order->setStatus($status);
158162

159163
$order = $this->orderRepository->save($order);
160164
$creditmemo = $this->creditmemoRepository->save($creditmemo);

app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Sales\Test\Unit\Model\Order;
78

89
use Magento\Framework\Model\Context;
@@ -1526,7 +1527,7 @@ public function testRefund()
15261527
$this->orderStateResolver->expects($this->once())->method('getStateForOrder')
15271528
->with($this->order)
15281529
->willReturn(Order::STATE_CLOSED);
1529-
$this->mockGetDefaultStatus(Order::STATE_CLOSED, $status);
1530+
$this->mockGetDefaultStatus(Order::STATE_CLOSED, $status, ['first, second']);
15301531
$this->assertOrderUpdated(Order::STATE_PROCESSING, $status, $message);
15311532

15321533
static::assertSame($this->payment, $this->payment->refund($this->creditMemoMock));

app/code/Magento/Sales/Test/Unit/Model/RefundOrderTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Sales\Test\Unit\Model;
78

89
use Magento\Framework\App\ResourceConnection;
@@ -245,9 +246,9 @@ public function testOrderCreditmemo($orderId, $notify, $appendComment)
245246
->method('setState')
246247
->with(Order::STATE_CLOSED)
247248
->willReturnSelf();
248-
$this->orderMock->expects($this->once())
249-
->method('getState')
250-
->willReturn(Order::STATE_CLOSED);
249+
$this->configMock->expects($this->once())
250+
->method('getStateStatuses')
251+
->willReturn(['first, second']);
251252
$this->configMock->expects($this->once())
252253
->method('getStateDefaultStatus')
253254
->with(Order::STATE_CLOSED)

0 commit comments

Comments
 (0)