File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
Model/ResourceModel/Category
Test/Unit/Model/ResourceModel/Category/Collection Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ public function joinUrlRewrite()
371371 ['request_path ' ],
372372 sprintf (
373373 '{{table}}.is_autogenerated = 1 AND {{table}}.store_id = %d AND {{table}}.entity_type = \'%s \'' ,
374- $ this ->_storeManager -> getStore ()-> getId (),
374+ $ this ->getStoreId (),
375375 CategoryUrlRewriteGenerator::ENTITY_TYPE
376376 ),
377377 '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