@@ -160,7 +160,7 @@ protected function setUp()
160160 false
161161 );
162162 $ this ->customer = $ this ->getMockBuilder (\Magento \Customer \Api \Data \CustomerInterface::class)
163- ->setMethods (['__toArray ' ])
163+ ->setMethods (['__toArray ' , ' setGroupId ' ])
164164 ->disableOriginalConstructor ()
165165 ->getMockForAbstractClass ();
166166 $ this ->model = new \Magento \Customer \Model \ResourceModel \CustomerRepository (
@@ -187,6 +187,7 @@ public function testSave()
187187 {
188188 $ customerId = 1 ;
189189 $ storeId = 2 ;
190+ $ groupId = 1 ;
190191
191192 $ region = $ this ->getMockForAbstractClass (\Magento \Customer \Api \Data \RegionInterface::class, [], '' , false );
192193 $ address = $ this ->getMockForAbstractClass (
@@ -222,6 +223,7 @@ public function testSave()
222223 [
223224 'getId ' ,
224225 'setId ' ,
226+ 'setGroupId ' ,
225227 'setStoreId ' ,
226228 'getStoreId ' ,
227229 'getAttributeSetId ' ,
@@ -254,7 +256,8 @@ public function testSave()
254256 'getEmail ' ,
255257 'getWebsiteId ' ,
256258 'getAddresses ' ,
257- 'setAddresses '
259+ 'setAddresses ' ,
260+ 'getGroupId '
258261 ]
259262 );
260263 $ customerSecureData = $ this ->getMock (
@@ -289,6 +292,17 @@ public function testSave()
289292 ->method ('setCustomerId ' )
290293 ->with ($ customerId )
291294 ->willReturnSelf ();
295+
296+ $ this ->customer ->expects ($ this ->exactly (2 ))
297+ ->method ('getGroupId ' )
298+ ->willReturn ($ groupId );
299+ $ customerAttributesMetaData ->expects ($ this ->once ())
300+ ->method ('getGroupId ' )
301+ ->willReturn (null );
302+ $ customerModel ->expects ($ this ->once ())
303+ ->method ('setGroupId ' )
304+ ->with ($ groupId );
305+
292306 $ address ->expects ($ this ->once ())
293307 ->method ('getRegion ' )
294308 ->willReturn ($ region );
0 commit comments