@@ -41,28 +41,35 @@ class ConfigProviderTest extends \PHPUnit_Framework_TestCase
41
41
*/
42
42
protected $ store ;
43
43
44
+ /**
45
+ * @var Url|\PHPUnit_Framework_MockObject_MockObject
46
+ */
47
+ private $ customerUrl ;
48
+
44
49
protected function setUp ()
45
50
{
46
51
$ this ->storeManager = $ this ->getMockForAbstractClass (
47
- ' Magento\Store\Model\StoreManagerInterface ' ,
52
+ \ Magento \Store \Model \StoreManagerInterface::class ,
48
53
[],
49
54
'' ,
50
55
false
51
56
);
57
+
52
58
$ this ->urlBuilder = $ this ->getMockForAbstractClass (
53
- ' Magento\Framework\UrlInterface ' ,
59
+ \ Magento \Framework \UrlInterface::class ,
54
60
[],
55
61
'' ,
56
62
false
57
63
);
64
+
58
65
$ this ->scopeConfig = $ this ->getMockForAbstractClass (
59
- ' Magento\Framework\App\Config\ScopeConfigInterface ' ,
66
+ \ Magento \Framework \App \Config \ScopeConfigInterface::class ,
60
67
[],
61
68
'' ,
62
69
false
63
70
);
64
71
$ this ->store = $ this ->getMockForAbstractClass (
65
- ' Magento\Store\Api\Data\StoreInterface ' ,
72
+ \ Magento \Store \Api \Data \StoreInterface::class ,
66
73
[],
67
74
'' ,
68
75
false ,
@@ -71,10 +78,16 @@ protected function setUp()
71
78
['getBaseUrl ' ]
72
79
);
73
80
81
+ $ this ->customerUrl = $ this ->getMockBuilder (\Magento \Customer \Model \Url::class)
82
+ ->disableOriginalConstructor ()
83
+ ->setMethods (['getLoginUrl ' ])
84
+ ->getMock ();
85
+
74
86
$ this ->provider = new ConfigProvider (
75
87
$ this ->urlBuilder ,
76
88
$ this ->storeManager ,
77
- $ this ->scopeConfig
89
+ $ this ->scopeConfig ,
90
+ $ this ->customerUrl
78
91
);
79
92
}
80
93
@@ -83,9 +96,8 @@ public function testGetConfigWithoutRedirect()
83
96
$ loginUrl = 'http://url.test/customer/login ' ;
84
97
$ baseUrl = 'http://base-url.test ' ;
85
98
86
- $ this ->urlBuilder ->expects ($ this ->exactly (2 ))
87
- ->method ('getUrl ' )
88
- ->with (Url::ROUTE_ACCOUNT_LOGIN )
99
+ $ this ->customerUrl ->expects ($ this ->exactly (2 ))
100
+ ->method ('getLoginUrl ' )
89
101
->willReturn ($ loginUrl );
90
102
$ this ->storeManager ->expects ($ this ->once ())
91
103
->method ('getStore ' )
@@ -112,9 +124,8 @@ public function testGetConfig()
112
124
$ loginUrl = 'http://base-url.test/customer/login ' ;
113
125
$ baseUrl = 'http://base-url.test ' ;
114
126
115
- $ this ->urlBuilder ->expects ($ this ->exactly (2 ))
116
- ->method ('getUrl ' )
117
- ->with (Url::ROUTE_ACCOUNT_LOGIN )
127
+ $ this ->customerUrl ->expects ($ this ->exactly (2 ))
128
+ ->method ('getLoginUrl ' )
118
129
->willReturn ($ loginUrl );
119
130
$ this ->storeManager ->expects ($ this ->once ())
120
131
->method ('getStore ' )
0 commit comments