88namespace Magento \Customer \Test \Unit \Model ;
99
1010use Magento \Customer \Model \Customer as CustomerModel ;
11+ use Magento \Customer \Model \CustomerFactory ;
1112use Magento \Customer \Model \CustomerAuthUpdate ;
1213use Magento \Customer \Model \CustomerRegistry ;
1314use Magento \Customer \Model \Data \CustomerSecure ;
@@ -36,9 +37,9 @@ class CustomerAuthUpdateTest extends TestCase
3637 protected $ customerResourceModel ;
3738
3839 /**
39- * @var CustomerModel |MockObject
40+ * @var CustomerFactory |MockObject
4041 */
41- protected $ customerModel ;
42+ protected $ customerFactory ;
4243
4344 /**
4445 * @var ObjectManager
@@ -56,15 +57,15 @@ protected function setUp(): void
5657 $ this ->createMock (CustomerRegistry::class);
5758 $ this ->customerResourceModel =
5859 $ this ->createMock (CustomerResourceModel::class);
59- $ this ->customerModel =
60- $ this ->createMock (CustomerModel ::class);
60+ $ this ->customerFactory =
61+ $ this ->createMock (CustomerFactory ::class);
6162
6263 $ this ->model = $ this ->objectManager ->getObject (
6364 CustomerAuthUpdate::class,
6465 [
6566 'customerRegistry ' => $ this ->customerRegistry ,
6667 'customerResourceModel ' => $ this ->customerResourceModel ,
67- 'customerModel ' => $ this ->customerModel
68+ 'customerFactory ' => $ this ->customerFactory
6869 ]
6970 );
7071 }
@@ -115,9 +116,14 @@ public function testSaveAuth()
115116 $ customerId
116117 );
117118
118- $ this ->customerModel ->expects ($ this ->once ())
119+ $ customerModel = $ this ->createMock (CustomerModel::class);
120+ $ customerModel ->expects ($ this ->once ())
119121 ->method ('reindex ' );
120122
123+ $ this ->customerFactory ->expects ($ this ->once ())
124+ ->method ('create ' )
125+ ->willReturn ($ customerModel );
126+
121127 $ this ->model ->saveAuth ($ customerId );
122128 }
123129}
0 commit comments