17
17
use Magento \Catalog \Model \ResourceModel \Product \Compare \Item \Collection ;
18
18
use Magento \Framework \App \Config \ScopeConfigInterface ;
19
19
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
20
- use Magento \Framework \UrlInterface ;
21
- use Magento \Store \Model \StoreManagerInterface ;
22
20
use Magento \Store \Model \Website ;
23
21
use PHPUnit \Framework \MockObject \MockObject ;
24
22
use PHPUnit \Framework \TestCase ;
23
+ use Magento \Store \Model \StoreManagerInterface ;
25
24
26
- /**
27
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28
- */
29
25
class CompareProductsTest extends TestCase
30
26
{
31
27
/**
@@ -68,11 +64,6 @@ class CompareProductsTest extends TestCase
68
64
*/
69
65
private $ websiteMock ;
70
66
71
- /**
72
- * @var UrlInterface|MockObject
73
- */
74
- private $ urlBuilder ;
75
-
76
67
/**
77
68
* @var array
78
69
*/
@@ -97,9 +88,6 @@ protected function setUp(): void
97
88
$ this ->scopeConfigMock = $ this ->getMockBuilder (ScopeConfigInterface::class)
98
89
->disableOriginalConstructor ()
99
90
->getMockForAbstractClass ();
100
- $ this ->urlBuilder = $ this ->getMockBuilder (UrlInterface::class)
101
- ->disableOriginalConstructor ()
102
- ->getMock ();
103
91
104
92
$ this ->storeManagerMock = $ this ->getMockBuilder (
105
93
StoreManagerInterface::class
@@ -109,7 +97,7 @@ protected function setUp(): void
109
97
$ this ->websiteMock = $ this ->getMockBuilder (
110
98
Website::class
111
99
)->onlyMethods (
112
- ['getId ' ]
100
+ ['getId ' , ]
113
101
)->disableOriginalConstructor ()
114
102
->getMock ();
115
103
@@ -122,8 +110,8 @@ protected function setUp(): void
122
110
'productUrl ' => $ this ->productUrlMock ,
123
111
'outputHelper ' => $ this ->outputHelperMock ,
124
112
'scopeConfig ' => $ this ->scopeConfigMock ,
125
- 'storeManager ' => $ this ->storeManagerMock ,
126
- ' urlBuilder ' => $ this -> urlBuilder
113
+ 'storeManager ' => $ this ->storeManagerMock
114
+
127
115
]
128
116
);
129
117
}
@@ -231,10 +219,9 @@ public function testGetSectionData()
231
219
->method ('getItemCollection ' )
232
220
->willReturn ($ itemCollectionMock );
233
221
234
- $ this ->urlBuilder ->expects ($ this ->once ())
235
- ->method ('getUrl ' )
222
+ $ this ->helperMock ->expects ($ this ->once ())
223
+ ->method ('getListUrl ' )
236
224
->willReturn ('http://list.url ' );
237
-
238
225
$ this ->storeManagerMock ->expects ($ this ->any ())->method ('getWebsite ' )->willReturn ($ this ->websiteMock );
239
226
$ this ->websiteMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
240
227
$ this ->assertEquals (
@@ -282,8 +269,8 @@ public function testGetSectionDataNoItems()
282
269
$ this ->helperMock ->expects ($ this ->never ())
283
270
->method ('getItemCollection ' );
284
271
285
- $ this ->urlBuilder ->expects ($ this ->once ())
286
- ->method ('getUrl ' )
272
+ $ this ->helperMock ->expects ($ this ->once ())
273
+ ->method ('getListUrl ' )
287
274
->willReturn ('http://list.url ' );
288
275
289
276
$ this ->storeManagerMock ->expects ($ this ->any ())->method ('getWebsite ' )->willReturn ($ this ->websiteMock );
@@ -327,8 +314,8 @@ public function testGetSectionDataSingleItem()
327
314
->method ('getItemCollection ' )
328
315
->willReturn ($ itemCollectionMock );
329
316
330
- $ this ->urlBuilder ->expects ($ this ->once ())
331
- ->method ('getUrl ' )
317
+ $ this ->helperMock ->expects ($ this ->once ())
318
+ ->method ('getListUrl ' )
332
319
->willReturn ('http://list.url ' );
333
320
334
321
$ this ->assertEquals (
0 commit comments