public function testLoadDictionnaries() { $loader = $this->getMock('AppBundle\\Game\\Loader\\TextFileLoader'); $loader->expects($this->once())->method('load')->will($this->returnValue(array('php'))); $wordlist = new WordList(); $wordlist->addLoader('txt', $loader); $wordlist->loadDictionaries(array('/path/to/fake/dictionnary.txt')); $this->assertContains('php', $wordlist->getWords()[3]); }
public function testLoadDictionaries() { $path = '/path/to/words.txt'; $loader = $this->getMock(LoaderInterface::class); $loader->expects($this->once())->method('load')->with($path)->willReturn(['argus']); $wordList = new WordList(); $wordList->addLoader('txt', $loader); $wordList->loadDictionaries([$path]); $words = self::readProperty('words', $wordList); $this->assertContains('argus', $words[5]); }
public function testLoadDictionaries() { $loader = $this->getMock('AppBundle\\Game\\Loader\\LoaderInterface'); $loader->expects($this->exactly(2))->method('load')->willReturn(['foo', 'bar', 'baz']); $wordList = new WordList(); $wordList->addLoader('txt', $loader); $wordList->loadDictionaries(['foo.txt', 'bar.txt']); $words = self::getPropertyValue($wordList, 'words'); $this->assertArrayHasKey(3, $words); $this->assertCount(3, $words[3]); }