File tree 2 files changed +9
-12
lines changed
app/code/Magento/CatalogUrlRewrite
Model/Category/Plugin/Category
Test/Unit/Model/Category/Plugin/Category 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,11 @@ public function afterChangeParent(
67
67
$ categoryStoreId = $ category ->getStoreId ();
68
68
foreach ($ category ->getStoreIds () as $ storeId ) {
69
69
$ category ->setStoreId ($ storeId );
70
- if (!$ this ->isGlobalScope ($ storeId )) {
71
- $ this ->updateCategoryUrlKeyForStore ($ category );
72
- $ category ->unsUrlPath ();
73
- $ category ->setUrlPath ($ this ->categoryUrlPathGenerator ->getUrlPath ($ category ));
74
- $ category ->getResource ()->saveAttribute ($ category , 'url_path ' );
75
- $ this ->updateUrlPathForChildren ($ category );
76
- }
70
+ $ this ->updateCategoryUrlKeyForStore ($ category );
71
+ $ category ->unsUrlPath ();
72
+ $ category ->setUrlPath ($ this ->categoryUrlPathGenerator ->getUrlPath ($ category ));
73
+ $ category ->getResource ()->saveAttribute ($ category , 'url_path ' );
74
+ $ this ->updateUrlPathForChildren ($ category );
77
75
}
78
76
$ category ->setStoreId ($ categoryStoreId );
79
77
Original file line number Diff line number Diff line change @@ -91,27 +91,26 @@ protected function setUp(): void
91
91
public function testAfterChangeParent ()
92
92
{
93
93
$ urlPath = 'test/path ' ;
94
- $ storeIds = [1 ];
94
+ $ storeIds = [0 , 1 ];
95
95
$ originalCategory = $ this ->getMockBuilder (Category::class)
96
96
->disableOriginalConstructor ()
97
97
->getMock ();
98
98
$ this ->categoryFactory ->method ('create ' )
99
99
->willReturn ($ originalCategory );
100
-
101
100
$ this ->categoryMock ->method ('getResource ' )
102
101
->willReturn ($ this ->subjectMock );
103
102
$ this ->categoryMock ->expects ($ this ->once ())
104
103
->method ('getStoreIds ' )
105
104
->willReturn ($ storeIds );
106
- $ this ->childrenCategoriesProviderMock ->expects ($ this ->once ( ))
105
+ $ this ->childrenCategoriesProviderMock ->expects ($ this ->exactly ( 2 ))
107
106
->method ('getChildren ' )
108
107
->with ($ this ->categoryMock , true )
109
108
->willReturn ([]);
110
- $ this ->categoryUrlPathGeneratorMock ->expects ($ this ->once ( ))
109
+ $ this ->categoryUrlPathGeneratorMock ->expects ($ this ->exactly ( 2 ))
111
110
->method ('getUrlPath ' )
112
111
->with ($ this ->categoryMock )
113
112
->willReturn ($ urlPath );
114
- $ this ->categoryMock ->expects ($ this ->once ( ))
113
+ $ this ->categoryMock ->expects ($ this ->exactly ( 2 ))
115
114
->method ('setUrlPath ' )
116
115
->with ($ urlPath );
117
116
$ this ->assertSame (
You can’t perform that action at this time.
0 commit comments