Skip to content

Commit 57355ec

Browse files
author
Tommy Quissens
committed
updated code following code review & backward compatible development guide
# Conflicts: # app/code/Magento/Customer/Test/Unit/Model/Checkout/ConfigProviderTest.php
1 parent df3b306 commit 57355ec

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

app/code/Magento/Customer/Model/Checkout/ConfigProvider.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ class ConfigProvider implements ConfigProviderInterface
2222

2323
/**
2424
* @var UrlInterface
25+
* @deprecated
26+
*/
27+
protected $urlBuilder;
28+
29+
/**
30+
* @var Url
2531
*/
2632
protected $customerUrl;
2733

@@ -31,18 +37,21 @@ class ConfigProvider implements ConfigProviderInterface
3137
protected $scopeConfig;
3238

3339
/**
34-
* @param Url $customerUrl
40+
* @param UrlInterface $urlBuilder
3541
* @param StoreManagerInterface $storeManager
3642
* @param ScopeConfigInterface $scopeConfig
43+
* @param Url $customerUrl
3744
*/
3845
public function __construct(
39-
Url $customerUrl,
46+
UrlInterface $urlBuilder,
4047
StoreManagerInterface $storeManager,
41-
ScopeConfigInterface $scopeConfig
48+
ScopeConfigInterface $scopeConfig,
49+
Url $customerUrl = null
4250
) {
43-
$this->customerUrl = $customerUrl;
51+
$this->urlBuilder=$urlBuilder;
4452
$this->storeManager = $storeManager;
4553
$this->scopeConfig = $scopeConfig;
54+
$this->customerUrl = $customerUrl ?? \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Customer\Model\Url::class);
4655
}
4756

4857
/**

app/code/Magento/Customer/Test/Unit/Model/Checkout/ConfigProviderTest.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Customer\Test\Unit\Model\Checkout;
@@ -14,7 +14,7 @@
1414
use Magento\Customer\Model\Form;
1515
use Magento\Store\Model\ScopeInterface;
1616

17-
class ConfigProviderTest extends \PHPUnit_Framework_TestCase
17+
class ConfigProviderTest extends \PHPUnit\Framework\TestCase
1818
{
1919
/**
2020
* @var ConfigProvider
@@ -29,7 +29,7 @@ class ConfigProviderTest extends \PHPUnit_Framework_TestCase
2929
/**
3030
* @var UrlInterface|\PHPUnit_Framework_MockObject_MockObject
3131
*/
32-
protected $customerUrl;
32+
protected $urlBuilder;
3333

3434
/**
3535
* @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -41,6 +41,11 @@ class ConfigProviderTest extends \PHPUnit_Framework_TestCase
4141
*/
4242
protected $store;
4343

44+
/**
45+
* @var Url|\PHPUnit_Framework_MockObject_MockObject
46+
*/
47+
private $customerUrl;
48+
4449
protected function setUp()
4550
{
4651
$this->storeManager = $this->getMockForAbstractClass(
@@ -50,10 +55,12 @@ protected function setUp()
5055
false
5156
);
5257

53-
$this->customerUrl = $this->getMockBuilder(\Magento\Customer\Model\Url::class)
54-
->disableOriginalConstructor()
55-
->setMethods(['getLoginUrl'])
56-
->getMock();
58+
$this->urlBuilder = $this->getMockForAbstractClass(
59+
\Magento\Framework\UrlInterface::class,
60+
[],
61+
'',
62+
false
63+
);
5764

5865
$this->scopeConfig = $this->getMockForAbstractClass(
5966
\Magento\Framework\App\Config\ScopeConfigInterface::class,
@@ -71,10 +78,16 @@ protected function setUp()
7178
['getBaseUrl']
7279
);
7380

81+
$this->customerUrl = $this->getMockBuilder(\Magento\Customer\Model\Url::class)
82+
->disableOriginalConstructor()
83+
->setMethods(['getLoginUrl'])
84+
->getMock();
85+
7486
$this->provider = new ConfigProvider(
75-
$this->customerUrl,
87+
$this->urlBuilder,
7688
$this->storeManager,
77-
$this->scopeConfig
89+
$this->scopeConfig,
90+
$this->customerUrl
7891
);
7992
}
8093

0 commit comments

Comments
 (0)