Exemple #1
0
 public function testGetRandomWord()
 {
     $wordList = new WordList();
     $wordList->addWord('php');
     $wordList->addWord('foo');
     $wordList->addWord('bar');
     $this->assertRegExp('/^(?:php|foo|bar)$/', $wordList->getRandomWord(3));
 }
 public function testGetRandomWord()
 {
     $wordList = new WordList();
     $wordList->addWord('ruby');
     $wordList->addWord('java');
     $wordList->addWord('toto');
     $found = [];
     while (3 !== count($found)) {
         $word = $wordList->getRandomWord(4);
         $found[$word] = $word;
     }
     $this->assertContains('ruby', $found);
     $this->assertContains('java', $found);
     $this->assertContains('toto', $found);
 }