File tree 2 files changed +41
-1
lines changed
Model/ResourceModel/Category
Test/Unit/Model/ResourceModel/Category/Collection 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -313,7 +313,7 @@ public function joinUrlRewrite()
313
313
['request_path ' ],
314
314
sprintf (
315
315
'{{table}}.is_autogenerated = 1 AND {{table}}.store_id = %d AND {{table}}.entity_type = \'%s \'' ,
316
- $ this ->_storeManager -> getStore ()-> getId (),
316
+ $ this ->getStoreId (),
317
317
CategoryUrlRewriteGenerator::ENTITY_TYPE
318
318
),
319
319
'left '
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Catalog \Test \Unit \Model \ResourceModel \Category \Collection ;
8
+
9
+ class UrlRewriteTest extends \PHPUnit \Framework \TestCase
10
+ {
11
+ /**
12
+ * @var \PHPUnit_Framework_MockObject_MockObject
13
+ */
14
+ protected $ _model ;
15
+
16
+ protected function setUp ()
17
+ {
18
+ $ this ->_model = $ this ->getMockBuilder (
19
+ \Magento \Catalog \Model \ResourceModel \Category \Collection::class
20
+ )->disableOriginalConstructor ()
21
+ ->setMethodsExcept (['joinUrlRewrite ' , 'setStoreId ' , 'getStoreId ' ])
22
+ ->getMock ();
23
+ }
24
+
25
+
26
+ public function testStoreIdUsedByUrlRewrite ()
27
+ {
28
+ $ this ->_model ->expects ($ this ->once ())
29
+ ->method ('joinTable ' )
30
+ ->with (
31
+ $ this ->anything (),
32
+ $ this ->anything (),
33
+ $ this ->anything (),
34
+ $ this ->equalTo ('{{table}}.is_autogenerated = 1 AND {{table}}.store_id = 100 AND {{table}}.entity_type = \'category \'' ),
35
+ $ this ->anything ()
36
+ );
37
+ $ this ->_model ->setStoreId (100 );
38
+ $ this ->_model ->joinUrlRewrite ();
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments