20
20
use PHPUnit \Framework \MockObject \MockObject ;
21
21
use PHPUnit \Framework \TestCase ;
22
22
23
- /**
24
- * Test GetCustomerByToken class
25
- */
26
23
class GetCustomerByTokenTest extends TestCase
27
24
{
28
- protected const RESET_PASSWORD = 'resetPassword ' ;
25
+ private const RESET_PASSWORD = 'resetPassword ' ;
29
26
30
27
/**
31
28
* @var SearchCriteriaBuilder|MockObject
32
29
*/
33
- protected $ searchCriteriaBuilderMock ;
30
+ private $ searchCriteriaBuilderMock ;
34
31
35
32
/**
36
33
* @var SearchCriteria|MockObject
37
34
*/
38
- protected $ searchCriteriaMock ;
35
+ private $ searchCriteriaMock ;
39
36
40
37
/**
41
38
* @var CustomerRepositoryInterface|MockObject
42
39
*/
43
- protected $ customerRepositoryMock ;
40
+ private $ customerRepositoryMock ;
44
41
45
42
/**
46
43
* @var CustomerSearchResultsInterface|MockObject
47
44
*/
48
- protected $ searchResultMock ;
45
+ private $ searchResultMock ;
49
46
50
47
/**
51
48
* @var CustomerInterface|MockObject
52
49
*/
53
- protected $ customerMock ;
50
+ private $ customerMock ;
54
51
55
52
/**
56
53
* @var GetCustomerByToken;
57
54
*/
58
- protected $ model ;
55
+ private $ model ;
59
56
60
- /**
61
- * @inheritDoc
62
- */
63
- public function setUp ()
57
+ protected function setUp ()
64
58
{
65
59
$ this ->searchCriteriaBuilderMock = $ this ->createMock (SearchCriteriaBuilder::class);
66
60
$ this ->searchCriteriaMock = $ this ->createMock (SearchCriteria::class);
@@ -86,15 +80,10 @@ public function setUp()
86
80
->willReturn ($ this ->searchResultMock );
87
81
}
88
82
89
- /**
90
- * @return void
91
- */
92
- public function testExecute (): void
83
+ public function testExecuteReturnWhenOneItemAvailable (): void
93
84
{
94
85
$ totalCount = 1 ;
95
- $ this ->searchResultMock ->expects ($ this ->any ())
96
- ->method ('getTotalCount ' )
97
- ->willReturn ($ totalCount );
86
+ $ this ->searchResultMock ->method ('getTotalCount ' )->willReturn ($ totalCount );
98
87
$ this ->searchResultMock ->expects ($ this ->once ())
99
88
->method ('getItems ' )
100
89
->willReturn ([$ this ->customerMock ]);
@@ -105,15 +94,10 @@ public function testExecute(): void
105
94
);
106
95
}
107
96
108
- /**
109
- * @return void
110
- */
111
97
public function testExecuteWithNoSuchEntityException (): void
112
98
{
113
99
$ totalCount = 0 ;
114
- $ this ->searchResultMock ->expects ($ this ->any ())
115
- ->method ('getTotalCount ' )
116
- ->willReturn ($ totalCount );
100
+ $ this ->searchResultMock ->method ('getTotalCount ' )->willReturn ($ totalCount );
117
101
$ this ->expectExceptionObject (new NoSuchEntityException (
118
102
new Phrase (
119
103
'No such entity with rp_token = %value ' ,
@@ -124,15 +108,10 @@ public function testExecuteWithNoSuchEntityException(): void
124
108
$ this ->model ->execute (self ::RESET_PASSWORD );
125
109
}
126
110
127
- /**
128
- * @return void
129
- */
130
111
public function testExecuteWithExpireException (): void
131
112
{
132
113
$ totalCount = 2 ;
133
- $ this ->searchResultMock ->expects ($ this ->any ())
134
- ->method ('getTotalCount ' )
135
- ->willReturn ($ totalCount );
114
+ $ this ->searchResultMock ->method ('getTotalCount ' )->willReturn ($ totalCount );
136
115
137
116
$ this ->expectExceptionObject (new ExpiredException (
138
117
new Phrase (
0 commit comments