Пример #1
0
 public function testPopulateDictionary()
 {
     Dictionary::populateDictionary();
     $this->dictionary = Dictionary::getDictionary();
     $this->assertEquals(20, count($this->dictionary));
     $this->assertNotEquals(21, count($this->dictionary));
 }
Пример #2
0
 public function run()
 {
     //populate dictionary
     Dictionary::populateDictionary();
     //get the populated dictionary
     print "Populating the dictionary <br/>";
     $dictionary = Dictionary::getDictionary();
     var_export($dictionary);
     print "<br/>";
     //create a word
     print "Creating a word<br/>";
     $word = $this->dictionaryManager->createEntry('Excitement', 'A state of agitation or happiness', 'He was very excited at the thought of dinner with the Whites this night.');
     var_export($word);
     print "<br/>";
     //find a word
     print "Finding a word<br/>";
     $foundWord = $this->dictionaryManager->findEntry('Excitement');
     var_export($foundWord);
     print "<br/>";
     //edit a word
     print "Editing a word<br/>";
     $edited = $this->dictionaryManager->editEntry("Excitement", "Extreme happiness", "He wasn't very excited this morning. this.");
     var_export($edited);
     print "<br/>";
     //rank word
     print "Ranking words<br/>";
     try {
         $ranked = $this->rank->rankWords($this->dictionaryManager->findEntry('Excitement'));
         var_export($ranked);
         print "<br/>";
     } catch (InvalidArgumentException $e) {
         echo $e->getMessage() . "<br/>";
     }
     //delete a word
     print "Deleting a word<br/>";
     $dictionary = $this->dictionaryManager->deleteEntry('Excitement');
     var_export($dictionary);
 }
Пример #3
0
 /**
  * Set up the test data and other dependencies
  */
 protected function setUp()
 {
     $this->dictionary = Dictionary::getDictionary();
     $this->manager = new DictionaryManager();
     $this->array = $this->manager->createEntry("tight", "When someone shows approval", "Andrei: Prosper, have you completed the curriculum.\nProsper: Yes.\nAndrei: Tight, Tight, Tight!!!.");
 }
 protected function setUp()
 {
     $this->dictionary = Dictionary::getDictionary();
     $this->manager = new DictionaryManager();
     $this->populatedDictionary = Dictionary::populateDictionary();
 }