Skip to content

Commit 4e3da15

Browse files
authored
Merge pull request #5002 from magento-tsg/2.3-develop-pr89
[TSG] Fixes for 2.3 (pr89) (2.3-develop)
2 parents 8112a38 + 525928d commit 4e3da15

File tree

23 files changed

+239
-236
lines changed

23 files changed

+239
-236
lines changed

app/code/Magento/Eav/etc/db_schema.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,6 @@
458458
<constraint xsi:type="foreign" referenceId="EAV_ATTRIBUTE_OPTION_VALUE_STORE_ID_STORE_STORE_ID"
459459
table="eav_attribute_option_value" column="store_id" referenceTable="store"
460460
referenceColumn="store_id" onDelete="CASCADE"/>
461-
<constraint xsi:type="unique" referenceId="EAV_ATTRIBUTE_OPTION_VALUE_STORE_ID_OPTION_ID">
462-
<column name="store_id"/>
463-
<column name="option_id"/>
464-
</constraint>
465461
<index referenceId="EAV_ATTRIBUTE_OPTION_VALUE_OPTION_ID" indexType="btree">
466462
<column name="option_id"/>
467463
</index>

app/code/Magento/Eav/etc/db_schema_whitelist.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@
287287
"constraint": {
288288
"PRIMARY": true,
289289
"EAV_ATTR_OPT_VAL_OPT_ID_EAV_ATTR_OPT_OPT_ID": true,
290-
"EAV_ATTRIBUTE_OPTION_VALUE_STORE_ID_STORE_STORE_ID": true,
291-
"EAV_ATTRIBUTE_OPTION_VALUE_STORE_ID_OPTION_ID": true
290+
"EAV_ATTRIBUTE_OPTION_VALUE_STORE_ID_STORE_STORE_ID": true
292291
}
293292
},
294293
"eav_attribute_label": {
@@ -389,4 +388,4 @@
389388
"EAV_FORM_ELEMENT_TYPE_ID_ATTRIBUTE_ID": true
390389
}
391390
}
392-
}
391+
}

app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,38 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
declare(strict_types=1);
76

87
namespace Magento\OfflinePayments\Observer;
98

109
use Magento\Framework\Event\ObserverInterface;
1110
use Magento\OfflinePayments\Model\Banktransfer;
1211
use Magento\OfflinePayments\Model\Cashondelivery;
1312
use Magento\OfflinePayments\Model\Checkmo;
14-
use Magento\Sales\Model\Order\Payment;
1513

1614
/**
1715
* Sets payment additional information.
1816
*/
1917
class BeforeOrderPaymentSaveObserver implements ObserverInterface
2018
{
2119
/**
22-
* Sets current instructions for bank transfer account.
20+
* Sets current instructions for bank transfer account
2321
*
2422
* @param \Magento\Framework\Event\Observer $observer
2523
* @return void
26-
* @throws \Magento\Framework\Exception\LocalizedException
2724
*/
28-
public function execute(\Magento\Framework\Event\Observer $observer): void
25+
public function execute(\Magento\Framework\Event\Observer $observer)
2926
{
30-
/** @var Payment $payment */
27+
/** @var \Magento\Sales\Model\Order\Payment $payment */
3128
$payment = $observer->getEvent()->getPayment();
3229
$instructionMethods = [
3330
Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE,
3431
Cashondelivery::PAYMENT_METHOD_CASHONDELIVERY_CODE
3532
];
3633
if (in_array($payment->getMethod(), $instructionMethods)) {
37-
$payment->setAdditionalInformation('instructions', $this->getInstructions($payment));
34+
$payment->setAdditionalInformation(
35+
'instructions',
36+
$payment->getMethodInstance()->getInstructions()
37+
);
3838
} elseif ($payment->getMethod() === Checkmo::PAYMENT_METHOD_CHECKMO_CODE) {
3939
$methodInstance = $payment->getMethodInstance();
4040
if (!empty($methodInstance->getPayableTo())) {
@@ -45,17 +45,4 @@ public function execute(\Magento\Framework\Event\Observer $observer): void
4545
}
4646
}
4747
}
48-
49-
/**
50-
* Retrieve store-specific payment method instructions, or already saved if exists.
51-
*
52-
* @param Payment $payment
53-
* @return string|null
54-
* @throws \Magento\Framework\Exception\LocalizedException
55-
*/
56-
private function getInstructions(Payment $payment): ?string
57-
{
58-
return $payment->getAdditionalInformation('instructions')
59-
?: $payment->getMethodInstance()->getConfigData('instructions', $payment->getOrder()->getStoreId());
60-
}
6148
}

app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\OfflinePayments\Model\Banktransfer;
1212
use Magento\OfflinePayments\Model\Cashondelivery;
1313
use Magento\OfflinePayments\Observer\BeforeOrderPaymentSaveObserver;
14-
use Magento\Sales\Model\Order;
1514
use Magento\Sales\Model\Order\Payment;
1615
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1716
use Magento\OfflinePayments\Model\Checkmo;
@@ -77,12 +76,19 @@ public function testBeforeOrderPaymentSaveWithInstructions($methodCode)
7776
$this->payment->expects(self::once())
7877
->method('getMethod')
7978
->willReturn($methodCode);
80-
$this->payment->method('getAdditionalInformation')
81-
->with('instructions')
82-
->willReturn('payment configuration');
8379
$this->payment->expects(self::once())
8480
->method('setAdditionalInformation')
8581
->with('instructions', 'payment configuration');
82+
$method = $this->getMockBuilder(Banktransfer::class)
83+
->disableOriginalConstructor()
84+
->getMock();
85+
86+
$method->expects(self::once())
87+
->method('getInstructions')
88+
->willReturn('payment configuration');
89+
$this->payment->expects(self::once())
90+
->method('getMethodInstance')
91+
->willReturn($method);
8692

8793
$this->_model->execute($this->observer);
8894
}

app/code/Magento/OfflinePayments/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"php": "~7.1.3||~7.2.0||~7.3.0",
99
"magento/framework": "*",
1010
"magento/module-checkout": "*",
11-
"magento/module-payment": "*",
12-
"magento/module-sales": "*"
11+
"magento/module-payment": "*"
1312
},
1413
"suggest": {
1514
"magento/module-config": "*"

app/code/Magento/Payment/Block/Info/Instructions.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@ class Instructions extends \Magento\Payment\Block\Info
2525
*/
2626
protected $_template = 'Magento_Payment::info/instructions.phtml';
2727

28-
/**
29-
* Gets payment method title for appropriate store.
30-
*
31-
* @return string
32-
* @throws \Magento\Framework\Exception\LocalizedException
33-
*/
34-
public function getTitle()
35-
{
36-
return $this->getInfo()->getAdditionalInformation('method_title')
37-
?: $this->getMethod()->getConfigData('title', $this->getInfo()->getOrder()->getStoreId());
38-
}
39-
4028
/**
4129
* Get instructions text from order payment
4230
* (or from config, if instructions are missed in payment)

app/code/Magento/Payment/Test/Unit/Block/Info/InstructionsTest.php

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

7+
/**
8+
* Test class for \Magento\Payment\Block\Info\Instructions
9+
*/
710
namespace Magento\Payment\Test\Unit\Block\Info;
811

9-
use Magento\Payment\Model\MethodInterface;
10-
use Magento\Sales\Model\Order;
11-
use PHPUnit\Framework\MockObject\MockObject;
12-
1312
class InstructionsTest extends \PHPUnit\Framework\TestCase
1413
{
1514
/**
@@ -26,59 +25,10 @@ protected function setUp()
2625
{
2726
$context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
2827
$this->_instructions = new \Magento\Payment\Block\Info\Instructions($context);
29-
$this->_info = $this->getMockBuilder(\Magento\Payment\Model\Info::class)
30-
->setMethods(
31-
[
32-
'getOrder',
33-
'getAdditionalInformation',
34-
'getMethodInstance'
35-
]
36-
)
37-
->disableOriginalConstructor()
38-
->getMock();
28+
$this->_info = $this->createMock(\Magento\Payment\Model\Info::class);
3929
$this->_instructions->setData('info', $this->_info);
4030
}
4131

42-
/**
43-
* @return void
44-
* @throws \Magento\Framework\Exception\LocalizedException
45-
*/
46-
public function testGetTitleFromPaymentAdditionalData()
47-
{
48-
$this->_info->method('getAdditionalInformation')
49-
->with('method_title')
50-
->willReturn('payment_method_title');
51-
52-
$this->getMethod()->expects($this->never())
53-
->method('getConfigData');
54-
55-
$this->assertEquals($this->_instructions->getTitle(), 'payment_method_title');
56-
}
57-
58-
/**
59-
* @return void
60-
* @throws \Magento\Framework\Exception\LocalizedException
61-
*/
62-
public function testGetTitleFromPaymentMethodConfig()
63-
{
64-
$this->_info->method('getAdditionalInformation')
65-
->with('method_title')
66-
->willReturn(null);
67-
68-
$this->getMethod()->expects($this->once())
69-
->method('getConfigData')
70-
->with('title', null)
71-
->willReturn('payment_method_title');
72-
73-
$order = $this->getOrder();
74-
$this->_info->method('getOrder')->willReturn($order);
75-
76-
$this->assertEquals($this->_instructions->getTitle(), 'payment_method_title');
77-
}
78-
79-
/**
80-
* @return void
81-
*/
8232
public function testGetInstructionAdditionalInformation()
8333
{
8434
$this->_info->expects($this->once())
@@ -91,13 +41,10 @@ public function testGetInstructionAdditionalInformation()
9141
$this->assertEquals('get the instruction here', $this->_instructions->getInstructions());
9242
}
9343

94-
/**
95-
* @return void
96-
*/
9744
public function testGetInstruction()
9845
{
9946
$methodInstance = $this->getMockBuilder(
100-
MethodInterface::class
47+
\Magento\Payment\Model\MethodInterface::class
10148
)->getMockForAbstractClass();
10249
$methodInstance->expects($this->once())
10350
->method('getConfigData')
@@ -112,27 +59,4 @@ public function testGetInstruction()
11259
->willReturn($methodInstance);
11360
$this->assertEquals('get the instruction here', $this->_instructions->getInstructions());
11461
}
115-
116-
/**
117-
* @return MethodInterface|MockObject
118-
*/
119-
private function getMethod()
120-
{
121-
$method = $this->getMockBuilder(MethodInterface::class)
122-
->getMockForAbstractClass();
123-
$this->_info->method('getMethodInstance')
124-
->willReturn($method);
125-
126-
return $method;
127-
}
128-
129-
/**
130-
* @return Order|MockObject
131-
*/
132-
private function getOrder()
133-
{
134-
return $this->getMockBuilder(Order::class)
135-
->disableOriginalConstructor()
136-
->getMock();
137-
}
13862
}

app/code/Magento/Payment/view/adminhtml/templates/info/instructions.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @see \Magento\Payment\Block\Info
1010
*/
1111
?>
12-
<p><?= $block->escapeHtml($block->getTitle()) ?></p>
12+
<p><?= $block->escapeHtml($block->getMethod()->getTitle()) ?></p>
1313
<?php if ($block->getInstructions()) : ?>
1414
<table>
1515
<tbody>

app/code/Magento/Payment/view/frontend/templates/info/instructions.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
?>
1212
<dl class="payment-method">
13-
<dt class="title"><?= $block->escapeHtml($block->getTitle()) ?></dt>
13+
<dt class="title"><?= $block->escapeHtml($block->getMethod()->getTitle()) ?></dt>
1414
<?php if ($block->getInstructions()) : ?>
1515
<dd class="content"><?= /* @noEscape */ nl2br($block->escapeHtml($block->getInstructions())) ?></dd>
1616
<?php endif; ?>

app/code/Magento/Sales/Setup/Patch/Data/UpdateCreditmemoGridCurrencyCode.php

Lines changed: 0 additions & 85 deletions
This file was deleted.

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderInvoicesTabSection.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<element name="filters" type="button" selector="//div[@id='sales_order_view_tabs_order_invoices_content']//button[@data-action='grid-filter-expand']" timeout="30"/>
1818
<element name="applyFilters" type="button" selector="//div[@id='sales_order_view_tabs_order_invoices_content']//button[@data-action='grid-filter-apply']" timeout="30"/>
1919
<element name="invoiceId" type="input" selector="//div[@id='sales_order_view_tabs_order_invoices_content']//input[@name='increment_id']" timeout="30"/>
20-
<element name="amountFrom" type="input" selector="[name='base_grand_total[from]']" timeout="30"/>
21-
<element name="amountTo" type="input" selector="[name='base_grand_total[to]']" timeout="30"/>
20+
<element name="amountFrom" type="input" selector="[name='grand_total[from]']" timeout="30"/>
21+
<element name="amountTo" type="input" selector="[name='grand_total[to]']" timeout="30"/>
2222
</section>
23-
</sections>
23+
</sections>

app/code/Magento/Sales/etc/db_schema.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,8 +1386,6 @@
13861386
comment="Adjustment Negative"/>
13871387
<column xsi:type="decimal" name="order_base_grand_total" scale="4" precision="20" unsigned="false"
13881388
nullable="true" comment="Order Grand Total"/>
1389-
<column xsi:type="varchar" name="order_currency_code" nullable="true" length="3" comment="Order Currency Code"/>
1390-
<column xsi:type="varchar" name="base_currency_code" nullable="true" length="3" comment="Base Currency Code"/>
13911389
<constraint xsi:type="primary" referenceId="PRIMARY">
13921390
<column name="entity_id"/>
13931391
</constraint>

0 commit comments

Comments
 (0)