Skip to content

Commit 48bc84b

Browse files
committed
MAGETWO-60523: [GitHub] 404 error is received when clicking on Edit items link on multishipping #7257
1 parent 1e31e9f commit 48bc84b

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed

app/code/Magento/Multishipping/Block/Checkout/Billing/Items.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getQuote()
6868
*/
6969
public function getVirtualProductEditUrl()
7070
{
71-
return $this->getUrl('*/cart');
71+
return $this->getUrl('checkout/cart');
7272
}
7373

7474
/**

app/code/Magento/Multishipping/Block/Checkout/Overview.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function getBackUrl()
297297
*/
298298
public function getVirtualProductEditUrl()
299299
{
300-
return $this->getUrl('*/cart');
300+
return $this->getUrl('checkout/cart');
301301
}
302302

303303
/**
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Multishipping\Test\Unit\Block\Checkout\Billing;
8+
9+
10+
class ItemsTest extends \PHPUnit_Framework_TestCase
11+
{
12+
/**
13+
* @var \Magento\Multishipping\Block\Checkout\Billing\Items
14+
*/
15+
private $model;
16+
17+
/**
18+
* @var \PHPUnit_Framework_MockObject_MockObject
19+
*/
20+
private $urlBuilderMock;
21+
22+
protected function setUp()
23+
{
24+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
25+
$this->urlBuilderMock = $this->getMock(\Magento\Framework\UrlInterface::class);
26+
$this->model = $objectManager->getObject(
27+
\Magento\Multishipping\Block\Checkout\Billing\Items::class,
28+
[
29+
'urlBuilder' => $this->urlBuilderMock
30+
]
31+
);
32+
}
33+
34+
public function testGetVirtualProductEditUrl()
35+
{
36+
$url = 'http://example.com';
37+
$this->urlBuilderMock->expects($this->once())->method('getUrl')->with('checkout/cart', [])->willReturn($url);
38+
$this->assertEquals($url, $this->model->getVirtualProductEditUrl());
39+
}
40+
}

app/code/Magento/Multishipping/Test/Unit/Block/Checkout/OverviewTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ class OverviewTest extends \PHPUnit_Framework_TestCase
5252
*/
5353
protected $quoteMock;
5454

55+
/**
56+
* @var \PHPUnit_Framework_MockObject_MockObject
57+
*/
58+
private $urlBuilderMock;
59+
5560
protected function setUp()
5661
{
5762
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -83,13 +88,15 @@ protected function setUp()
8388
$this->checkoutMock =
8489
$this->getMock(\Magento\Multishipping\Model\Checkout\Type\Multishipping::class, [], [], '', false);
8590
$this->quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
91+
$this->urlBuilderMock = $this->getMock(\Magento\Framework\UrlInterface::class);
8692
$this->model = $objectManager->getObject(
8793
\Magento\Multishipping\Block\Checkout\Overview::class,
8894
[
8995
'priceCurrency' => $this->priceCurrencyMock,
9096
'totalsCollector' => $this->totalsCollectorMock,
9197
'totalsReader' => $this->totalsReaderMock,
92-
'multishipping' => $this->checkoutMock
98+
'multishipping' => $this->checkoutMock,
99+
'urlBuilder' => $this->urlBuilderMock
93100
]
94101
);
95102
}
@@ -189,4 +196,11 @@ protected function getTotalsMock($address)
189196
->willReturn([$totalMock]);
190197
return $totalMock;
191198
}
199+
200+
public function testGetVirtualProductEditUrl()
201+
{
202+
$url = 'http://example.com';
203+
$this->urlBuilderMock->expects($this->once())->method('getUrl')->with('checkout/cart', [])->willReturn($url);
204+
$this->assertEquals($url, $this->model->getVirtualProductEditUrl());
205+
}
192206
}

0 commit comments

Comments
 (0)