Skip to content

Commit 4df2c70

Browse files
author
Mike Weis
committed
Merge branch 'develop' into FearlessKiwis-MAGETWO-55117-ShippingMethodManagement-estimateByAddressId-not-full
2 parents ac31ab9 + 644e60d commit 4df2c70

File tree

88 files changed

+4612
-236
lines changed

Some content is hidden

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

88 files changed

+4612
-236
lines changed
Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Backup\Test\Unit\Controller\Adminhtml\Index;
7+
8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
9+
10+
/**
11+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
12+
* @SuppressWarnings(PHPMD.TooManyFields)
13+
*/
14+
class RollbackTest extends \PHPUnit_Framework_TestCase
15+
{
16+
/**
17+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
18+
*/
19+
private $objectManager;
20+
21+
/**
22+
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
23+
*/
24+
private $objectManagerMock;
25+
26+
/**
27+
* @var \Magento\Backend\App\Action\Context
28+
*/
29+
private $context;
30+
31+
/**
32+
* @var \Magento\Backup\Controller\Adminhtml\Index\Rollback
33+
*/
34+
private $rollbackController;
35+
36+
/**
37+
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
38+
*/
39+
private $requestMock;
40+
41+
/**
42+
* @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject
43+
*/
44+
private $responseMock;
45+
46+
/**
47+
* @var \Magento\Backup\Model\BackupFactory|\PHPUnit_Framework_MockObject_MockObject
48+
*/
49+
private $backupModelFactoryMock;
50+
51+
/**
52+
* @var \Magento\Backup\Model\Backup|\PHPUnit_Framework_MockObject_MockObject
53+
*/
54+
private $backupModelMock;
55+
56+
/**
57+
* @var \Magento\Backup\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
58+
*/
59+
private $dataHelperMock;
60+
61+
/**
62+
* @var \Magento\Framework\App\Response\Http\FileFactory|\PHPUnit_Framework_MockObject_MockObject
63+
*/
64+
private $fileFactoryMock;
65+
66+
/**
67+
* @var \Magento\Backend\Model\View\Result\RedirectFactory|\PHPUnit_Framework_MockObject_MockObject
68+
*/
69+
private $resultRedirectFactoryMock;
70+
71+
/**
72+
* @var \Magento\Backend\Model\View\Result\Redirect|\PHPUnit_Framework_MockObject_MockObject
73+
*/
74+
private $resultRedirectMock;
75+
76+
/**
77+
* @var \Magento\Backend\Model\View\Result\Forward|\PHPUnit_Framework_MockObject_MockObject
78+
*/
79+
private $resultForwardMock;
80+
81+
/**
82+
* @var \Magento\Framework\Backup\Factory|\PHPUnit_Framework_MockObject_MockObject
83+
*/
84+
private $backupFactoryMock;
85+
86+
/**
87+
* @var \Magento\Framework\Backup\BackupInterface|\PHPUnit_Framework_MockObject_MockObject
88+
*/
89+
private $backupManagerMock;
90+
91+
/**
92+
* @var \Magento\Backup\Model\ResourceModel\Db|\PHPUnit_Framework_MockObject_MockObject
93+
*/
94+
private $backupResourceModelMock;
95+
96+
protected function setUp()
97+
{
98+
$this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
99+
->getMock();
100+
$this->requestMock = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
101+
->setMethods(['initForward', 'setDispatched', 'isAjax'])
102+
->getMockForAbstractClass();
103+
$this->responseMock = $this->getMockBuilder(\Magento\Framework\App\ResponseInterface::class)
104+
->setMethods(['setRedirect', 'representJson'])
105+
->getMockForAbstractClass();
106+
$this->backupModelFactoryMock = $this->getMockBuilder(\Magento\Backup\Model\BackupFactory::class)
107+
->disableOriginalConstructor()
108+
->setMethods(['create'])
109+
->getMock();
110+
$this->backupModelMock = $this->getMockBuilder(\Magento\Backup\Model\Backup::class)
111+
->disableOriginalConstructor()
112+
->setMethods(['getTime', 'exists', 'getSize', 'output', 'validateUserPassword'])
113+
->getMock();
114+
$this->backupResourceModelMock = $this->getMockBuilder(\Magento\Backup\Model\ResourceModel\Db::class)
115+
->disableOriginalConstructor()
116+
->getMock();
117+
$this->dataHelperMock = $this->getMockBuilder(\Magento\Backup\Helper\Data::class)
118+
->disableOriginalConstructor()
119+
->setMethods(['isRollbackAllowed', 'getBackupsDir', 'invalidateCache'])
120+
->getMock();
121+
$this->fileFactoryMock = $this->getMockBuilder(\Magento\Framework\App\Response\Http\FileFactory::class)
122+
->disableOriginalConstructor()
123+
->getMock();
124+
$this->resultRedirectFactoryMock =
125+
$this->getMockBuilder(\Magento\Backend\Model\View\Result\RedirectFactory::class)
126+
->disableOriginalConstructor()
127+
->setMethods(['create'])
128+
->getMock();
129+
$this->resultRedirectMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Redirect::class)
130+
->disableOriginalConstructor()
131+
->getMock();
132+
$this->resultForwardMock = $this->getMockBuilder(\Magento\Backend\Model\View\Result\Forward::class)
133+
->disableOriginalConstructor()
134+
->getMock();
135+
$this->backupFactoryMock = $this->getMockBuilder(\Magento\Framework\Backup\Factory::class)
136+
->disableOriginalConstructor()
137+
->setMethods(['create'])
138+
->getMock();
139+
$this->backupManagerMock = $this->getMockBuilder(\Magento\Framework\Backup\BackupInterface::class)
140+
->setMethods(['setName'])
141+
->getMockForAbstractClass();
142+
$this->objectManager = new ObjectManager($this);
143+
$this->context = $this->objectManager->getObject(
144+
\Magento\Backend\App\Action\Context::class,
145+
[
146+
'objectManager' => $this->objectManagerMock,
147+
'request' => $this->requestMock,
148+
'response' => $this->responseMock,
149+
'resultRedirectFactory' => $this->resultRedirectFactoryMock
150+
]
151+
);
152+
$this->rollbackController = $this->objectManager->getObject(
153+
\Magento\Backup\Controller\Adminhtml\Index\Rollback::class,
154+
[
155+
'context' => $this->context,
156+
'backupFactory' => $this->backupFactoryMock,
157+
'backupModelFactory' => $this->backupModelFactoryMock,
158+
'fileFactory' => $this->fileFactoryMock
159+
]
160+
);
161+
}
162+
163+
public function testExecuteRollbackDisabled()
164+
{
165+
$rollbackAllowed = false;
166+
167+
$this->dataHelperMock->expects($this->once())
168+
->method('isRollbackAllowed')
169+
->willReturn($rollbackAllowed);
170+
$this->objectManagerMock->expects($this->once())
171+
->method('get')
172+
->with(\Magento\Backup\Helper\Data::class)
173+
->willReturn($this->dataHelperMock);
174+
175+
$this->assertSame($this->responseMock, $this->rollbackController->execute());
176+
}
177+
178+
public function testExecuteBackupNotFound()
179+
{
180+
$rollbackAllowed = true;
181+
$isAjax = true;
182+
$time = 0;
183+
$type = 'db';
184+
$exists = false;
185+
186+
$this->dataHelperMock->expects($this->once())
187+
->method('isRollbackAllowed')
188+
->willReturn($rollbackAllowed);
189+
$this->objectManagerMock->expects($this->atLeastOnce())
190+
->method('get')
191+
->with(\Magento\Backup\Helper\Data::class)
192+
->willReturn($this->dataHelperMock);
193+
$this->requestMock->expects($this->once())
194+
->method('isAjax')
195+
->willReturn($isAjax);
196+
$this->backupModelMock->expects($this->atLeastOnce())
197+
->method('getTime')
198+
->willReturn($time);
199+
$this->backupModelMock->expects($this->any())
200+
->method('exists')
201+
->willReturn($exists);
202+
$this->requestMock->expects($this->any())
203+
->method('getParam')
204+
->willReturnMap(
205+
[
206+
['time', null, $time],
207+
['type', null, $type]
208+
]
209+
);
210+
$this->backupModelFactoryMock->expects($this->once())
211+
->method('create')
212+
->with($time, $type)
213+
->willReturn($this->backupModelMock);
214+
215+
$this->assertSame($this->responseMock, $this->rollbackController->execute());
216+
}
217+
218+
public function testExecute()
219+
{
220+
$rollbackAllowed = true;
221+
$isAjax = true;
222+
$time = 1;
223+
$type = 'db';
224+
$exists = true;
225+
$passwordValid = true;
226+
227+
$this->dataHelperMock->expects($this->once())
228+
->method('isRollbackAllowed')
229+
->willReturn($rollbackAllowed);
230+
$this->objectManagerMock->expects($this->any())
231+
->method('get')
232+
->with(\Magento\Backup\Helper\Data::class)
233+
->willReturn($this->dataHelperMock);
234+
$this->requestMock->expects($this->once())
235+
->method('isAjax')
236+
->willReturn($isAjax);
237+
$this->backupModelMock->expects($this->atLeastOnce())
238+
->method('getTime')
239+
->willReturn($time);
240+
$this->backupModelMock->expects($this->any())
241+
->method('exists')
242+
->willReturn($exists);
243+
$this->requestMock->expects($this->any())
244+
->method('getParam')
245+
->willReturnMap(
246+
[
247+
['time', null, $time],
248+
['type', null, $type]
249+
]
250+
);
251+
$this->backupModelFactoryMock->expects($this->once())
252+
->method('create')
253+
->with($time, $type)
254+
->willReturn($this->backupModelMock);
255+
$this->backupManagerMock->expects($this->once())
256+
->method('setBackupExtension')
257+
->willReturn($this->backupManagerMock);
258+
$this->backupManagerMock->expects($this->once())
259+
->method('setTime')
260+
->willReturn($this->backupManagerMock);
261+
$this->backupManagerMock->expects($this->once())
262+
->method('setBackupsDir')
263+
->willReturn($this->backupManagerMock);
264+
$this->backupManagerMock->expects($this->once())
265+
->method('setName')
266+
->willReturn($this->backupManagerMock);
267+
$this->backupManagerMock->expects($this->once())
268+
->method('setResourceModel')
269+
->willReturn($this->backupManagerMock);
270+
$this->backupFactoryMock->expects($this->once())
271+
->method('create')
272+
->with($type)
273+
->willReturn($this->backupManagerMock);
274+
$this->objectManagerMock->expects($this->at(2))
275+
->method('create')
276+
->with(\Magento\Backup\Model\ResourceModel\Db::class, [])
277+
->willReturn($this->backupResourceModelMock);
278+
$this->objectManagerMock->expects($this->at(3))
279+
->method('create')
280+
->with(\Magento\Backup\Model\Backup::class, [])
281+
->willReturn($this->backupModelMock);
282+
$this->backupModelMock->expects($this->once())
283+
->method('validateUserPassword')
284+
->willReturn($passwordValid);
285+
286+
$this->rollbackController->execute();
287+
}
288+
}

app/code/Magento/Checkout/i18n/en_US.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ Login,Login
121121
Close,Close
122122
item,item
123123
items,items
124-
"Go to Checkout","Go to Checkout"
125124
"Recently added item(s)","Recently added item(s)"
126125
"View and edit cart","View and edit cart"
127126
"See Details","See Details"

app/code/Magento/Checkout/view/frontend/web/js/view/cart/totals.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
* Copyright © 2016 Magento. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
define(
6-
[
7-
'uiComponent',
8-
'Magento_Checkout/js/model/totals',
9-
'Magento_Checkout/js/model/shipping-service'
10-
],
11-
function (Component, totalsService, shippingService) {
12-
'use strict';
5+
define([
6+
'jquery',
7+
'uiComponent',
8+
'Magento_Checkout/js/model/totals',
9+
'Magento_Checkout/js/model/shipping-service'
10+
], function ($, Component, totalsService, shippingService) {
11+
'use strict';
1312

14-
return Component.extend({
13+
return Component.extend({
14+
isLoading: totalsService.isLoading,
1515

16-
isLoading: totalsService.isLoading,
17-
18-
/**
19-
* @override
20-
*/
21-
initialize: function () {
22-
this._super();
23-
totalsService.totals.subscribe(function () {
24-
window.dispatchEvent(new Event('resize'));
25-
});
26-
shippingService.getShippingRates().subscribe(function () {
27-
window.dispatchEvent(new Event('resize'));
28-
});
29-
}
30-
});
31-
}
32-
);
16+
/**
17+
* @override
18+
*/
19+
initialize: function () {
20+
this._super();
21+
totalsService.totals.subscribe(function () {
22+
$(window).trigger('resize');
23+
});
24+
shippingService.getShippingRates().subscribe(function () {
25+
$(window).trigger('resize');
26+
});
27+
}
28+
});
29+
});

app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
<!-- /ko -->
3737
</div>
3838

39-
<!-- ko if: getCartParam('possible_onepage_checkout') -->
40-
<!-- ko foreach: getRegion('subtotalContainer') -->
41-
<!-- ko template: getTemplate() --><!-- /ko -->
42-
<!-- /ko -->
39+
<!-- ko foreach: getRegion('subtotalContainer') -->
40+
<!-- ko template: getTemplate() --><!-- /ko -->
4341
<!-- /ko -->
4442

4543
<!-- ko foreach: getRegion('extraInfo') -->
@@ -56,11 +54,11 @@
5654
data-action="close"
5755
data-bind="
5856
attr: {
59-
title: $t('Go to Checkout')
57+
title: $t('Proceed to Checkout')
6058
},
6159
click: closeMinicart()
6260
">
63-
<!-- ko i18n: 'Go to Checkout' --><!-- /ko -->
61+
<!-- ko i18n: 'Proceed to Checkout' --><!-- /ko -->
6462
</button>
6563
<div data-bind="html: getCartParam('extra_actions')"></div>
6664
</div>

app/code/Magento/Customer/view/frontend/templates/address/edit.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575
value="<?php echo $block->escapeHtml($block->getStreetLine(1)) ?>"
7676
title="<?php /* @escapeNotVerified */ echo __('Street Address') ?>"
7777
id="street_1"
78-
class="input-text <?php /* @escapeNotVerified */
79-
echo $_streetValidationClass ?>"/>
78+
class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>"/>
8079
<div class="nested">
8180
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
8281
<?php for ($_i = 1, $_n = $this->helper('Magento\Customer\Helper\Address')->getStreetLines(); $_i < $_n; $_i++): ?>
@@ -88,7 +87,8 @@
8887
<input type="text" name="street[]"
8988
value="<?php echo $block->escapeHtml($block->getStreetLine($_i + 1)) ?>"
9089
title="<?php /* @escapeNotVerified */ echo __('Street Address %1', $_i + 1) ?>"
91-
id="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>" echo $_streetValidationClass ?>">
90+
id="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>"
91+
class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>">
9292
</div>
9393
</div>
9494
<?php endfor; ?>

0 commit comments

Comments
 (0)