@@ -114,40 +114,41 @@ protected function setUp(): void
114114 public function testAfterChangeParent ()
115115 {
116116 $ urlPath = 'test/path ' ;
117- $ storeId = 0 ;
117+ $ storeIds = [ 0 , 1 ] ;
118118
119- $ this ->storeManagerMock ->expects ($ this ->once ())->method ('hasSingleStore ' )->willReturn (false );
120- $ this ->categoryMock ->expects ($ this ->exactly (3 ))->method ('getStoreId ' )
121- ->willReturn ($ storeId );
122- $ this ->categoryMock ->expects ($ this ->exactly (2 ))->method ('setStoreId ' )
123- ->willReturnOnConsecutiveCalls ($ storeId );
119+ $ this ->storeManagerMock ->expects ($ this ->exactly (2 ))->method ('hasSingleStore ' )->willReturn (false );
120+ $ this ->categoryMock ->expects ($ this ->exactly (6 ))->method ('getStoreId ' )
121+ ->willReturnOnConsecutiveCalls (0 , 0 , 1 , 0 , 1 , 0 );
122+ $ this ->categoryMock ->expects ($ this ->once ())->method ('getStoreIds ' )->willReturn ($ storeIds );
123+ $ this ->categoryMock ->expects ($ this ->exactly (5 ))->method ('setStoreId ' )
124+ ->willReturnOnConsecutiveCalls (0 , 0 , 1 , 0 , 1 );
124125
125- $ this ->categoryMock ->expects ($ this ->once ( ))->method ('getData ' )
126+ $ this ->categoryMock ->expects ($ this ->exactly ( 2 ))->method ('getData ' )
126127 ->willReturnOnConsecutiveCalls ('1/3/5 ' , '1/3/5 ' );
127- $ this ->categoryMock ->expects ($ this ->once ( ))->method ('getOrigData ' )
128+ $ this ->categoryMock ->expects ($ this ->exactly ( 2 ))->method ('getOrigData ' )
128129 ->willReturnOnConsecutiveCalls ('1/2/5 ' , '1/2/5 ' );
129- $ this ->categoryMock ->expects ($ this ->exactly (4 ))->method ('unsUrlPath ' )->willReturnSelf ();
130- $ this ->childrenCategoriesProviderMock ->expects ($ this ->exactly (2 ))->method ('getChildren ' )
130+ $ this ->categoryMock ->expects ($ this ->exactly (6 ))->method ('unsUrlPath ' )->willReturnSelf ();
131+ $ this ->childrenCategoriesProviderMock ->expects ($ this ->exactly (4 ))->method ('getChildren ' )
131132 ->with ($ this ->categoryMock , true )
132133 ->willReturnOnConsecutiveCalls ([$ this ->categoryMock ], [$ this ->categoryMock ], [], []);
133134
134- $ this ->categoryMock ->expects ($ this ->exactly (4 ))->method ('getResource ' )->willReturn ($ this ->subjectMock );
135- $ this ->subjectMock ->expects ($ this ->exactly (4 ))->method ('saveAttribute ' )
135+ $ this ->categoryMock ->expects ($ this ->exactly (6 ))->method ('getResource ' )->willReturn ($ this ->subjectMock );
136+ $ this ->subjectMock ->expects ($ this ->exactly (6 ))->method ('saveAttribute ' )
136137 ->with ($ this ->categoryMock , 'url_path ' )->willReturnSelf ();
137- $ this ->categoryMock ->expects ($ this ->once ( ))->method ('getId ' )->willReturnSelf ();
138+ $ this ->categoryMock ->expects ($ this ->exactly ( 2 ))->method ('getId ' )->willReturnSelf ();
138139
139140 $ originalCategory = $ this ->getMockBuilder (Category::class)->disableOriginalConstructor ()->getMock ();
140- $ originalCategory ->expects ($ this ->once ( ))->method ('getUrlKey ' )->willReturn ('url-key ' );
141- $ originalCategory ->expects ($ this ->once ( ))->method ('setStoreId ' )->willReturnSelf ();
142- $ originalCategory ->expects ($ this ->once ( ))->method ('load ' )->willReturnSelf ();
143- $ this ->categoryFactory ->expects ($ this ->once ( ))->method ('create ' )
141+ $ originalCategory ->expects ($ this ->exactly ( 2 ))->method ('getUrlKey ' )->willReturn ('url-key ' );
142+ $ originalCategory ->expects ($ this ->exactly ( 2 ))->method ('setStoreId ' )->willReturnSelf ();
143+ $ originalCategory ->expects ($ this ->exactly ( 2 ))->method ('load ' )->willReturnSelf ();
144+ $ this ->categoryFactory ->expects ($ this ->exactly ( 2 ))->method ('create ' )
144145 ->willReturn ($ originalCategory );
145- $ this ->categoryMock ->expects ($ this ->once ( ))->method ('setUrlKey ' )->with ('url-key ' )
146+ $ this ->categoryMock ->expects ($ this ->exactly ( 2 ))->method ('setUrlKey ' )->with ('url-key ' )
146147 ->willReturnSelf ();
147148
148- $ this ->categoryUrlPathGeneratorMock ->expects ($ this ->exactly (2 ))->method ('getUrlPath ' )
149+ $ this ->categoryUrlPathGeneratorMock ->expects ($ this ->exactly (4 ))->method ('getUrlPath ' )
149150 ->with ($ this ->categoryMock )->willReturn ($ urlPath );
150- $ this ->categoryMock ->expects ($ this ->exactly (2 ))->method ('setUrlPath ' )->with ($ urlPath );
151+ $ this ->categoryMock ->expects ($ this ->exactly (4 ))->method ('setUrlPath ' )->with ($ urlPath );
151152
152153 $ this ->assertSame (
153154 $ this ->subjectMock ,
0 commit comments