Skip to content

Commit bbf865f

Browse files
author
Tommy Quissens
committed
updated code following code review & backward compatible development guide
1 parent 73b9007 commit bbf865f

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
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: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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,7 +55,12 @@ protected function setUp()
5055
false
5156
);
5257

53-
$this->customerUrl = $this->createMock(\Magento\Customer\Model\Url::class);
58+
$this->urlBuilder = $this->getMockForAbstractClass(
59+
\Magento\Framework\UrlInterface::class,
60+
[],
61+
'',
62+
false
63+
);
5464

5565
$this->scopeConfig = $this->getMockForAbstractClass(
5666
\Magento\Framework\App\Config\ScopeConfigInterface::class,
@@ -68,10 +78,13 @@ protected function setUp()
6878
['getBaseUrl']
6979
);
7080

81+
$this->customerUrl = $this->createMock(\Magento\Customer\Model\Url::class);
82+
7183
$this->provider = new ConfigProvider(
72-
$this->customerUrl,
84+
$this->urlBuilder,
7385
$this->storeManager,
74-
$this->scopeConfig
86+
$this->scopeConfig,
87+
$this->customerUrl
7588
);
7689
}
7790

0 commit comments

Comments
 (0)