@@ -182,9 +182,32 @@ the same best practice defaults used by ``createStub()``.
182
182
}
183
183
184
184
In the examples so far we have been returning simple values using
185
- ``willReturn($value) ``. This short syntax is the same as
186
- ``will($this->returnValue($value)) ``. We can use variations
187
- on this longer syntax to achieve more complex stubbing behaviour.
185
+ ``willReturn($value) `` – a short syntax for convenience. :numref: `test-doubles.stubs.shorthands ` shows the
186
+ available stubbing short hands alongside their longer counterparts.
187
+
188
+ .. rst-class :: table
189
+ .. list-table :: Stubbing short hands
190
+ :name: test-doubles.stubs.shorthands
191
+ :header-rows: 1
192
+
193
+ * - short hand
194
+ - longer syntax
195
+ * - ``willReturn($value) ``
196
+ - ``will($this->returnValue($value)) ``
197
+ * - ``willReturnArgument($argumentIndex) ``
198
+ - ``will($this->returnArgument($argumentIndex)) ``
199
+ * - ``willReturnCallback($callback) ``
200
+ - ``will($this->returnCallback($callback)) ``
201
+ * - ``willReturnMap($valueMap) ``
202
+ - ``will($this->returnValueMap($valueMap)) ``
203
+ * - ``willReturnOnConsecutiveCalls($value1, $value2) ``
204
+ - ``will($this->onConsecutiveCalls($value1, $value2)) ``
205
+ * - ``willReturnSelf() ``
206
+ - ``will($this->returnSelf()) ``
207
+ * - ``willThrowException($exception) ``
208
+ - ``will($this->throwException($exception)) ``
209
+
210
+ We can use variations on this longer syntax to achieve more complex stubbing behaviour.
188
211
189
212
Sometimes you want to return one of the arguments of a method call
190
213
(unchanged) as the result of a stubbed method call.
0 commit comments