/** * Set expected responses. */ protected function replies($replies) { if ($this->useService) { return; } if (!$this->prophecy) { $this->getHttpClient(); } $responses = array(); foreach ($replies as $reply) { if (!$reply instanceof Reply) { $reply = new Reply($reply); } $responses[] = $reply->getResponse(); } $this->prophecy->request(Argument::any())->will(new ReturnPromise($responses)); $this->total_calls += count($responses); $this->prophecy->request(Argument::any())->shouldBeCalledTimes($this->total_calls); }