8
8
namespace Magento \Customer \Test \Unit \Model ;
9
9
10
10
use Magento \Customer \Model \Customer as CustomerModel ;
11
+ use Magento \Customer \Model \CustomerFactory ;
11
12
use Magento \Customer \Model \CustomerAuthUpdate ;
12
13
use Magento \Customer \Model \CustomerRegistry ;
13
14
use Magento \Customer \Model \Data \CustomerSecure ;
@@ -36,9 +37,9 @@ class CustomerAuthUpdateTest extends TestCase
36
37
protected $ customerResourceModel ;
37
38
38
39
/**
39
- * @var CustomerModel |MockObject
40
+ * @var CustomerFactory |MockObject
40
41
*/
41
- protected $ customerModel ;
42
+ protected $ customerFactory ;
42
43
43
44
/**
44
45
* @var ObjectManager
@@ -56,15 +57,15 @@ protected function setUp(): void
56
57
$ this ->createMock (CustomerRegistry::class);
57
58
$ this ->customerResourceModel =
58
59
$ this ->createMock (CustomerResourceModel::class);
59
- $ this ->customerModel =
60
- $ this ->createMock (CustomerModel ::class);
60
+ $ this ->customerFactory =
61
+ $ this ->createMock (CustomerFactory ::class);
61
62
62
63
$ this ->model = $ this ->objectManager ->getObject (
63
64
CustomerAuthUpdate::class,
64
65
[
65
66
'customerRegistry ' => $ this ->customerRegistry ,
66
67
'customerResourceModel ' => $ this ->customerResourceModel ,
67
- 'customerModel ' => $ this ->customerModel
68
+ 'customerFactory ' => $ this ->customerFactory
68
69
]
69
70
);
70
71
}
@@ -115,9 +116,14 @@ public function testSaveAuth()
115
116
$ customerId
116
117
);
117
118
118
- $ this ->customerModel ->expects ($ this ->once ())
119
+ $ customerModel = $ this ->createMock (CustomerModel::class);
120
+ $ customerModel ->expects ($ this ->once ())
119
121
->method ('reindex ' );
120
122
123
+ $ this ->customerFactory ->expects ($ this ->once ())
124
+ ->method ('create ' )
125
+ ->willReturn ($ customerModel );
126
+
121
127
$ this ->model ->saveAuth ($ customerId );
122
128
}
123
129
}
0 commit comments