@@ 145-162 (lines=18) @@ | ||
142 | * |
|
143 | * @throws \Prophecy\Exception\InvalidArgumentException |
|
144 | */ |
|
145 | public function will($promise) |
|
146 | { |
|
147 | if (is_callable($promise)) { |
|
148 | $promise = new Promise\CallbackPromise($promise); |
|
149 | } |
|
150 | ||
151 | if (!$promise instanceof Promise\PromiseInterface) { |
|
152 | throw new InvalidArgumentException(sprintf( |
|
153 | 'Expected callable or instance of PromiseInterface, but got %s.', |
|
154 | gettype($promise) |
|
155 | )); |
|
156 | } |
|
157 | ||
158 | $this->bindToObjectProphecy(); |
|
159 | $this->promise = $promise; |
|
160 | ||
161 | return $this; |
|
162 | } |
|
163 | ||
164 | /** |
|
165 | * Sets return promise to the prophecy. |
|
@@ 258-275 (lines=18) @@ | ||
255 | * |
|
256 | * @throws \Prophecy\Exception\InvalidArgumentException |
|
257 | */ |
|
258 | public function should($prediction) |
|
259 | { |
|
260 | if (is_callable($prediction)) { |
|
261 | $prediction = new Prediction\CallbackPrediction($prediction); |
|
262 | } |
|
263 | ||
264 | if (!$prediction instanceof Prediction\PredictionInterface) { |
|
265 | throw new InvalidArgumentException(sprintf( |
|
266 | 'Expected callable or instance of PredictionInterface, but got %s.', |
|
267 | gettype($prediction) |
|
268 | )); |
|
269 | } |
|
270 | ||
271 | $this->bindToObjectProphecy(); |
|
272 | $this->prediction = $prediction; |
|
273 | ||
274 | return $this; |
|
275 | } |
|
276 | ||
277 | /** |
|
278 | * Sets call prediction to the prophecy. |