Skip to content

Commit 6415e3d

Browse files
Merge pull request #1801 from magento-borg/Borg-PR-11-29
[borg] Backports: MAGETWO-69213, MAGETWO-69577, MAGETWO-84822
2 parents d7583ca + 5205d53 commit 6415e3d

File tree

34 files changed

+780
-407
lines changed

34 files changed

+780
-407
lines changed

app/autoload.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,3 @@
3535
}
3636

3737
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
38-
39-
// Sets default autoload mappings, may be overridden in Bootstrap::create
40-
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);

app/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
}
2929

3030
require_once __DIR__ . '/autoload.php';
31+
// Sets default autoload mappings, may be overridden in Bootstrap::create
32+
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
33+
3134
require_once BP . '/app/functions.php';
3235

3336
/* Custom umask value may be provided in optional mage_umask file in root */

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ define(
3636
braintreeDeviceData: null,
3737
paymentMethodNonce: null,
3838
lastBillingAddress: null,
39+
ccCode: null,
40+
ccMessageContainer: null,
3941
validatorManager: validatorManager,
4042
code: 'braintree',
4143

@@ -138,9 +140,39 @@ define(
138140
return;
139141
}
140142

143+
this.restoreMessageContainer();
144+
this.restoreCode();
145+
146+
/**
147+
* Define onReady callback
148+
*/
149+
braintree.onReady = function () {};
141150
this.initBraintree();
142151
},
143152

153+
/**
154+
* Restore original message container for cc-form component
155+
*/
156+
restoreMessageContainer: function () {
157+
this.messageContainer = this.ccMessageContainer;
158+
},
159+
160+
/**
161+
* Restore original code for cc-form component
162+
*/
163+
restoreCode: function () {
164+
this.code = this.ccCode;
165+
},
166+
167+
/** @inheritdoc */
168+
initChildren: function () {
169+
this._super();
170+
this.ccMessageContainer = this.messageContainer;
171+
this.ccCode = this.code;
172+
173+
return this;
174+
},
175+
144176
/**
145177
* Init config
146178
*/

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/vault.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ define([
5252
var self = this;
5353

5454
/**
55-
* Define already callback
55+
* Define onReady callback
5656
*/
5757
Braintree.onReady = function () {
5858
self.getPaymentMethodNonce();
@@ -78,6 +78,7 @@ define([
7878
formComponent.setPaymentMethodNonce(response.paymentMethodNonce);
7979
formComponent.additionalData['public_hash'] = self.publicHash;
8080
formComponent.code = self.code;
81+
formComponent.messageContainer = self.messageContainer;
8182
formComponent.placeOrder();
8283
});
8384
})

app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/AfterProductLoadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function setUp()
5252
->with($productId)
5353
->willReturn($stockItemMock);
5454

55-
$this->productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtension')
55+
$this->productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtensionInterface')
5656
->setMethods(['setStockItem'])
5757
->getMock();
5858
$this->productExtensionMock->expects($this->once())

app/code/Magento/Customer/Test/Unit/Model/Renderer/RegionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class RegionTest extends \PHPUnit_Framework_TestCase
1414
public function testRender($regionCollection)
1515
{
1616
$countryFactoryMock = $this->getMock(
17-
'Magento\Directory\Model\CountryFactory',
18-
['create'],
17+
\Magento\Directory\Model\CountryFactory::class,
18+
[],
1919
[],
2020
'',
2121
false

app/code/Magento/Customer/view/frontend/web/js/model/customer-addresses.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ define(
1515
return {
1616
getAddressItems: function() {
1717
var items = [];
18-
if (isLoggedIn) {
18+
if (isLoggedIn()) {
1919
var customerData = window.customerData;
2020
if (Object.keys(customerData).length) {
2121
$.each(customerData.addresses, function (key, item) {

app/code/Magento/Directory/Model/CountryFactory.php

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

app/code/Magento/Downloadable/Test/Unit/Model/Sales/Order/Pdf/Items/CreditmemoTest.php

Lines changed: 26 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,30 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase
1010
/**
1111
* @var \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Creditmemo
1212
*/
13-
protected $_model;
13+
private $model;
1414

1515
/**
1616
* @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject
1717
*/
18-
protected $_order;
18+
private $order;
1919

2020
/**
2121
* @var \Magento\Sales\Model\Order\Pdf\AbstractPdf|\PHPUnit_Framework_MockObject_MockObject
2222
*/
23-
protected $_pdf;
23+
private $pdf;
2424

2525
protected function setUp()
2626
{
2727
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
28-
$arguments = [
29-
'productFactory' => $this->getMock('Magento\Catalog\Model\ProductFactory', [], [], '', false),
30-
'orderItemCollectionFactory' => $this->getMock(
31-
'Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory',
32-
[],
33-
[],
34-
'',
35-
false
36-
),
37-
'serviceOrderFactory' => $this->getMock(
38-
'Magento\Sales\Model\Service\OrderFactory',
39-
[],
40-
[],
41-
'',
42-
false
43-
),
44-
'currencyFactory' => $this->getMock(
45-
'Magento\Directory\Model\CurrencyFactory',
46-
[],
47-
[],
48-
'',
49-
false
50-
),
51-
'orderHistoryFactory' => $this->getMock(
52-
'Magento\Sales\Model\Order\Status\HistoryFactory',
53-
[],
54-
[],
55-
'',
56-
false
57-
),
58-
'orderTaxCollectionFactory' => $this->getMock(
59-
'Magento\Tax\Model\ResourceModel\Sales\Order\Tax\CollectionFactory',
60-
[],
61-
[],
62-
'',
63-
false
64-
),
65-
];
66-
$orderConstructorArgs = $objectManager->getConstructArguments('Magento\Sales\Model\Order', $arguments);
67-
$this->_order = $this->getMock('Magento\Sales\Model\Order', ['formatPriceTxt'], $orderConstructorArgs);
68-
$this->_order->expects(
69-
$this->any()
70-
)->method(
71-
'formatPriceTxt'
72-
)->will(
73-
$this->returnCallback([$this, 'formatPrice'])
74-
);
28+
$this->order = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
29+
->disableOriginalConstructor()
30+
->getMock();
31+
$this->order->expects($this->any())
32+
->method('formatPriceTxt')
33+
->will($this->returnCallback([$this, 'formatPrice']));
7534

76-
$this->_pdf = $this->getMock(
77-
'Magento\Sales\Model\Order\Pdf\AbstractPdf',
35+
$this->pdf = $this->getMock(
36+
\Magento\Sales\Model\Order\Pdf\AbstractPdf::class,
7837
['drawLineBlocks', 'getPdf'],
7938
[],
8039
'',
@@ -96,22 +55,22 @@ protected function setUp()
9655
['string' => new \Magento\Framework\Stdlib\StringUtils(), 'filterManager' => $filterManager]
9756
);
9857

99-
$this->_model = $this->getMock(
100-
'Magento\Downloadable\Model\Sales\Order\Pdf\Items\Creditmemo',
58+
$this->model = $this->getMock(
59+
\Magento\Downloadable\Model\Sales\Order\Pdf\Items\Creditmemo::class,
10160
['getLinks', 'getLinksTitle'],
10261
$modelConstructorArgs
10362
);
10463

105-
$this->_model->setOrder($this->_order);
106-
$this->_model->setPdf($this->_pdf);
107-
$this->_model->setPage(new \Zend_Pdf_Page('a4'));
64+
$this->model->setOrder($this->order);
65+
$this->model->setPdf($this->pdf);
66+
$this->model->setPage(new \Zend_Pdf_Page('a4'));
10867
}
10968

11069
protected function tearDown()
11170
{
112-
$this->_model = null;
113-
$this->_order = null;
114-
$this->_pdf = null;
71+
$this->model = null;
72+
$this->order = null;
73+
$this->pdf = null;
11574
}
11675

11776
/**
@@ -150,7 +109,7 @@ public function testDraw()
150109
],
151110
];
152111

153-
$this->_model->setItem(
112+
$this->model->setItem(
154113
new \Magento\Framework\DataObject(
155114
[
156115
'name' => 'Downloadable Documentation',
@@ -170,8 +129,8 @@ public function testDraw()
170129
]
171130
)
172131
);
173-
$this->_model->expects($this->any())->method('getLinksTitle')->will($this->returnValue('Download Links'));
174-
$this->_model->expects(
132+
$this->model->expects($this->any())->method('getLinksTitle')->will($this->returnValue('Download Links'));
133+
$this->model->expects(
175134
$this->any()
176135
)->method(
177136
'getLinks'
@@ -184,7 +143,7 @@ public function testDraw()
184143
)
185144
)
186145
);
187-
$this->_pdf->expects(
146+
$this->pdf->expects(
188147
$this->once()
189148
)->method(
190149
'drawLineBlocks'
@@ -196,8 +155,8 @@ public function testDraw()
196155
$this->returnValue($expectedPdfPage)
197156
);
198157

199-
$this->assertNotSame($expectedPdfPage, $this->_model->getPage());
200-
$this->assertNull($this->_model->draw());
201-
$this->assertSame($expectedPdfPage, $this->_model->getPage());
158+
$this->assertNotSame($expectedPdfPage, $this->model->getPage());
159+
$this->assertNull($this->model->draw());
160+
$this->assertSame($expectedPdfPage, $this->model->getPage());
202161
}
203162
}

app/code/Magento/Paypal/Test/Unit/Model/PayflowproTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ protected function setUp()
118118
$client->expects($this->any())->method('request')->will($this->returnSelf());
119119
$client->expects($this->any())->method('getBody')->will($this->returnValue('RESULT name=value&name2=value2'));
120120

121-
$clientFactory = $this->getMock('Magento\Framework\HTTP\ZendClientFactory', ['create'], [], '', false);
122-
$clientFactory->expects($this->any())->method('create')->will($this->returnValue($client));
121+
$clientFactory = $this->getMockBuilder(ZendClientFactory::class)
122+
->disableOriginalConstructor()
123+
->getMock();
124+
$clientFactory->method('create')->will($this->returnValue($client));
123125

124126
$this->eventManager = $this->getMockForAbstractClass(ManagerInterface::class);
125127

app/code/Magento/Review/Test/Unit/Model/ResourceModel/Review/Product/CollectionTest.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,25 @@ protected function setUp()
6565
false
6666
);
6767
$fetchStrategy->expects($this->any())->method('fetchAll')->will($this->returnValue([]));
68-
$this->model = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))
69-
->getObject(
70-
'\Magento\Review\Model\ResourceModel\Review\Product\Collection',
71-
[
72-
'universalFactory' => $universalFactory,
73-
'storeManager' => $storeManager,
74-
'eavConfig' => $eavConfig,
75-
'fetchStrategy' => $fetchStrategy
76-
]
77-
);
68+
$productLimitationMock = $this->getMock(
69+
\Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitation::class
70+
);
71+
$productLimitationFactoryMock = $this->getMockBuilder(ProductLimitationFactory::class)
72+
->disableOriginalConstructor()
73+
->getMock();
74+
$productLimitationFactoryMock->method('create')
75+
->willReturn($productLimitationMock);
76+
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
77+
$this->model = $this->objectManager->getObject(
78+
\Magento\Review\Model\ResourceModel\Review\Product\Collection::class,
79+
[
80+
'universalFactory' => $universalFactory,
81+
'storeManager' => $storeManager,
82+
'eavConfig' => $eavConfig,
83+
'fetchStrategy' => $fetchStrategy,
84+
'productLimitationFactory' => $productLimitationFactoryMock
85+
]
86+
);
7887
}
7988

8089
/**

0 commit comments

Comments
 (0)