Skip to content

Commit 4784d00

Browse files
committed
Merge remote-tracking branch 'origin/develop' into MAGETWO-52844-2.1
2 parents 0cac75e + af9cffc commit 4784d00

File tree

146 files changed

+5960
-1192
lines changed

Some content is hidden

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

146 files changed

+5960
-1192
lines changed

app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,20 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceContainer name="notifications">
11-
<block class="Magento\AdminNotification\Block\System\Messages" name="system_messages" as="system_messages" before="-" template="Magento_AdminNotification::system/messages.phtml"/>
12-
<block class="Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup" name="unread_system_messages" as="unread_system_messages" after="system_messages" template="Magento_AdminNotification::system/messages/popup.phtml"/>
13-
<block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/>
11+
<block class="Magento\AdminNotification\Block\System\Messages"
12+
name="system_messages"
13+
as="system_messages"
14+
before="-"
15+
template="Magento_AdminNotification::system/messages.phtml"/>
16+
<block class="Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup"
17+
name="unread_system_messages"
18+
as="unread_system_messages"
19+
template="Magento_AdminNotification::system/messages/popup.phtml"/>
20+
<block class="Magento\AdminNotification\Block\Window"
21+
name="notification_window"
22+
as="notification_window"
23+
acl="Magento_AdminNotification::show_toolbar"
24+
template="notification/window.phtml"/>
1425
</referenceContainer>
1526
<referenceContainer name="header">
1627
<block class="Magento\AdminNotification\Block\ToolbarEntry" name="notification.messages" before="user" template="toolbar_entry.phtml"/>

app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/**
1414
* "Reset to Defaults" button renderer
1515
*
16+
* @deprecated
1617
* @author Magento Core Team <core@magentocommerce.com>
1718
*/
1819
class Reset extends \Magento\Config\Block\System\Config\Form\Field

app/code/Magento/Backend/Test/Unit/Block/Page/System/Config/Robots/ResetTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
*/
1010
namespace Magento\Backend\Test\Unit\Block\Page\System\Config\Robots;
1111

12+
/**
13+
* Class ResetTest
14+
* @deprecated
15+
* @package Magento\Backend\Test\Unit\Block\Page\System\Config\Robots
16+
*/
1217
class ResetTest extends \PHPUnit_Framework_TestCase
1318
{
1419
/**

app/code/Magento/Backend/view/adminhtml/templates/system/shipping/applicable_country.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CountryModel.prototype = {
3737
var showMethodElement = $(applyCountryElement.id.replace(/sallowspecific/, 'showmethod'));
3838
//var specifErrMsgElement = $(applyCountryElement.id.replace(/sallowspecific/, 'specificerrmsg'));
3939
if (specifCountryElement) {
40-
if (applyCountryElement.value == 1) {
40+
if (applyCountryElement.value == 1 && !specifCountryElement.hasAttribute('disabled')) {
4141
//if specific country element selected
4242
specifCountryElement.enable();
4343
if (showMethodElement) {

app/code/Magento/Braintree/Model/Report/Row/TransactionMap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@ public function setCustomAttribute($attributeCode, $attributeValue)
115115
*/
116116
public function getCustomAttributes()
117117
{
118+
$shouldBeLocalized = ['paymentInstrumentType', 'type', 'status'];
118119
$output = [];
119120
foreach ($this->getMappedValues() as $key => $value) {
120121
$attribute = $this->attributeValueFactory->create();
122+
if(in_array($key, $shouldBeLocalized)) {
123+
$value = __($value);
124+
}
121125
$output[] = $attribute->setAttributeCode($key)->setValue($value);
122126
}
123127
return $output;

app/code/Magento/Braintree/Model/Ui/ConfigProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public function getConfig()
7979
'payment' => [
8080
self::CODE => [
8181
'isActive' => $this->config->isActive(),
82-
'isSingleUse' => !$isPayPalActive,
8382
'clientToken' => $this->getClientToken(),
8483
'ccTypesMapper' => $this->config->getCctypesMapper(),
8584
'sdkUrl' => $this->config->getSdkUrl(),

app/code/Magento/Braintree/Test/Unit/Model/Report/TransactionMapTest.php

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Braintree\Model\Report\Row\TransactionMap;
1212
use Magento\Framework\Api\AttributeValue;
1313
use Magento\Framework\Api\AttributeValueFactory;
14+
use Magento\Framework\Phrase;
15+
use Magento\Framework\Phrase\RendererInterface;
1416
use Magento\Store\Model\StoreManagerInterface;
1517

1618
/**
@@ -30,6 +32,16 @@ class TransactionMapTest extends \PHPUnit_Framework_TestCase
3032
*/
3133
private $attributeValueFactoryMock;
3234

35+
/**
36+
* @var RendererInterface|\PHPUnit_Framework_MockObject_MockObject
37+
*/
38+
private $defaultRenderer;
39+
40+
/**
41+
* @var RendererInterface|\PHPUnit_Framework_MockObject_MockObject
42+
*/
43+
private $rendererMock;
44+
3345
/**
3446
* Setup
3547
*/
@@ -39,6 +51,9 @@ protected function setUp()
3951
->setMethods(['create'])
4052
->disableOriginalConstructor()
4153
->getMock();
54+
$this->defaultRenderer = Phrase::getRenderer();
55+
$this->rendererMock = $this->getMockBuilder(RendererInterface::class)
56+
->getMock();
4257
}
4358

4459
/**
@@ -65,6 +80,8 @@ public function testGetCustomAttributes($transaction)
6580
$this->transactionStub
6681
);
6782

83+
Phrase::setRenderer($this->rendererMock);
84+
6885
/** @var AttributeValue[] $result */
6986
$result = $map->getCustomAttributes();
7087

@@ -77,6 +94,31 @@ public function testGetCustomAttributes($transaction)
7794
$result[6]->getValue()
7895
);
7996
$this->assertEquals(implode(', ', $transaction['refundIds']), $result[11]->getValue());
97+
$this->assertEquals($transaction['merchantAccountId'], $result[1]->getValue());
98+
$this->assertEquals($transaction['orderId'], $result[2]->getValue());
99+
$this->assertEquals($transaction['amount'], $result[7]->getValue());
100+
$this->assertEquals($transaction['processorSettlementResponseCode'], $result[8]->getValue());
101+
$this->assertEquals($transaction['processorSettlementResponseText'], $result[10]->getValue());
102+
$this->assertEquals($transaction['settlementBatchId'], $result[12]->getValue());
103+
$this->assertEquals($transaction['currencyIsoCode'], $result[13]->getValue());
104+
105+
$this->rendererMock->expects($this->at(0))
106+
->method('render')
107+
->with([$transaction['paymentInstrumentType']])
108+
->willReturn('Credit card');
109+
$this->assertEquals('Credit card', $result[3]->getValue()->render());
110+
111+
$this->rendererMock->expects($this->at(0))
112+
->method('render')
113+
->with([$transaction['type']])
114+
->willReturn('Sale');
115+
$this->assertEquals('Sale', $result[5]->getValue()->render());
116+
117+
$this->rendererMock->expects($this->at(0))
118+
->method('render')
119+
->with([$transaction['status']])
120+
->willReturn('Pending for settlement');
121+
$this->assertEquals('Pending for settlement', $result[9]->getValue()->render());
80122
}
81123

82124
/**
@@ -90,9 +132,27 @@ public function getConfigDataProvider()
90132
'id' => 1,
91133
'createdAt' => new \DateTime(),
92134
'paypalDetails' => new PayPalDetails(['paymentId' => 10]),
93-
'refundIds' => [1, 2, 3, 4, 5]
135+
'refundIds' => [1, 2, 3, 4, 5],
136+
'merchantAccountId' => 'MerchantId',
137+
'orderId' => 1,
138+
'paymentInstrumentType' => 'credit_card',
139+
'type' => 'sale',
140+
'amount' => '$19.99',
141+
'processorSettlementResponseCode' => 1,
142+
'status' => 'pending_for_settlement',
143+
'processorSettlementResponseText' => 'sample text',
144+
'settlementBatchId' => 2,
145+
'currencyIsoCode' => 'USD'
94146
]
95147
]
96148
];
97149
}
150+
151+
/**
152+
* @return void
153+
*/
154+
protected function tearDown()
155+
{
156+
Phrase::setRenderer($this->defaultRenderer);
157+
}
98158
}

app/code/Magento/Braintree/Test/Unit/Model/Report/TransactionsCollectionTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,42 @@ public function testGetItemsWithNullLimit()
184184
$this->assertEquals(TransactionsCollection::TRANSACTION_MAXIMUM_COUNT, count($items));
185185
$this->assertInstanceOf(DocumentInterface::class, $items[1]);
186186
}
187+
188+
/**
189+
* Add fields to filter
190+
*
191+
* @dataProvider addToFilterDataProvider
192+
*/
193+
public function testAddToFilter($field, $condition, $filterMapperCall, $expectedCondition)
194+
{
195+
$this->filterMapperMock->expects(static::exactly($filterMapperCall))
196+
->method('getFilter')
197+
->with($field, $expectedCondition)
198+
->willReturn(new BraintreeSearchNodeStub());
199+
200+
$collection = new TransactionsCollection(
201+
$this->entityFactoryMock,
202+
$this->braintreeAdapterMock,
203+
$this->filterMapperMock
204+
);
205+
206+
static::assertInstanceOf(
207+
TransactionsCollection::class,
208+
$collection->addFieldToFilter($field, $condition)
209+
);
210+
}
211+
212+
/**
213+
* addToFilter DataProvider
214+
*
215+
* @return array
216+
*/
217+
public function addToFilterDataProvider()
218+
{
219+
return [
220+
['orderId', ['like' => 1], 1, ['like' => 1]],
221+
['type', 'sale', 1, ['eq' => 'sale']],
222+
[['type', 'orderId'], [], 0, []],
223+
];
224+
}
187225
}

app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public function getConfigDataProvider()
154154
'payment' => [
155155
ConfigProvider::CODE => [
156156
'isActive' => true,
157-
'isSingleUse' => false,
158157
'clientToken' => self::CLIENT_TOKEN,
159158
'ccTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
160159
'sdkUrl' => self::SDK_URL,

0 commit comments

Comments
 (0)