Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit a0cb9e5

Browse files
committed
also make other mock class setters fluent
1 parent da2d40c commit a0cb9e5

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

tests/mocks/MockDownstreamResponse.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ public function numberSuccess()
9090
return $this->numberTokensSuccess + count($this->tokensToModify);
9191
}
9292

93-
/**
94-
* Get the number of device which thrown an error.
95-
*
96-
* @return int
97-
*/public function numberFailure()
98-
{
99-
return count($this->tokensToDelete()) + count($this->tokensWithError);
100-
}
93+
/**
94+
* Get the number of device which thrown an error.
95+
*
96+
* @return int
97+
*/
98+
public function numberFailure()
99+
{
100+
return count($this->tokensToDelete()) + count($this->tokensWithError);
101+
}
101102

102103
/**
103104
* Get the number of device that you need to modify their token.
@@ -113,10 +114,12 @@ public function numberModification()
113114
* Add a token to delete.
114115
*
115116
* @param $token
117+
* @return MockDownstreamResponse
116118
*/
117119
public function addTokenToDelete($token)
118120
{
119121
$this->tokensToDelete[] = $token;
122+
return $this;
120123
}
121124

122125
/**
@@ -135,10 +138,12 @@ public function tokensToDelete()
135138
*
136139
* @param $oldToken
137140
* @param $newToken
141+
* @return MockDownstreamResponse
138142
*/
139143
public function addTokenToModify($oldToken, $newToken)
140144
{
141145
$this->tokensToModify[$oldToken] = $newToken;
146+
return $this;
142147
}
143148

144149
/**
@@ -158,10 +163,12 @@ public function tokensToModify()
158163
* Add a token to retry.
159164
*
160165
* @param $token
166+
* @return MockDownstreamResponse
161167
*/
162168
public function addTokenToRetry($token)
163169
{
164170
$this->tokensToRetry[] = $token;
171+
return $this;
165172
}
166173

167174
/**
@@ -179,10 +186,12 @@ public function tokensToRetry()
179186
*
180187
* @param $token
181188
* @param $message
189+
* @return MockDownstreamResponse
182190
*/
183191
public function addTokenWithError($token, $message)
184192
{
185193
$this->tokensWithError[$token] = $message;
194+
return $this;
186195
}
187196

188197
/**
@@ -202,10 +211,12 @@ public function tokensWithError()
202211
* change missing token state.
203212
*
204213
* @param $hasMissingToken
214+
* @return MockDownstreamResponse
205215
*/
206216
public function setMissingToken($hasMissingToken)
207217
{
208218
$this->hasMissingToken = $hasMissingToken;
219+
return $this;
209220
}
210221

211222
/**

tests/mocks/MockTopicResponse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ class MockTopicResponse implements TopicResponseContract
4141
* if success set a message id.
4242
*
4343
* @param $messageId
44+
* @return MockTopicResponse
4445
*/
4546
public function setSuccess($messageId)
4647
{
4748
$this->messageId = $messageId;
49+
return $this;
4850
}
4951

5052
/**
@@ -61,10 +63,12 @@ public function isSuccess()
6163
* set error.
6264
*
6365
* @param $error
66+
* @return MockTopicResponse
6467
*/
6568
public function setError($error)
6669
{
6770
$this->error = $error;
71+
return $this;
6872
}
6973

7074
/**

0 commit comments

Comments
 (0)