/** * Gets a random word of <length> characters for the <lang> language * <lang> must be an iso2 code in lower case * * @param int $length * @param string $lang * @param float $complexity * * @throws \InvalidArgumentException * * @return Word */ public function getRandomWord($length, $lang = 'en', $complexity = null) { $word = $this->wordRepository->getRandomWord($length, $lang, $complexity); if (!$word) { throw new \InvalidArgumentException('Could not find a word'); } return $word; }
private function repositoryWillNotReturnWord() { $this->repository->shouldReceive('getRandomWord')->with($this->length, $this->lang, $this->complexity)->andReturn(null); }