Esempio n. 1
0
 /**
  * Rimuove un commento dal sistema.
  * 
  * @param comment: il commento da rimuovere.
  * @return: il commento rimosso.
  */
 static function removeComment($comment)
 {
     return PostManager::removeComment($comment);
 }
Esempio n. 2
0
 /**
  * Crea un post;
  * Associa al post un commento (lo crea);
  * Cancella il commento dal database;
  * Carica il post e cerca di caricare il commento;
  * Controlla che il post non abbia quel commento e di non essere riuscito a caricare il commento;
  */
 function testDeleteComment()
 {
     $data = $this->post_data_all;
     $p = PostManager::createPost($data);
     $p1 = PostManager::commentPost($p, $this->author_id, $this->comment_text);
     if (count($p1->getComments()) == 0) {
         return "<br />Post deleting test NOT PASSED: not added";
     }
     $comm = $p1->getComments();
     $com = PostManager::loadComment($comm[0]->getId());
     $post = PostManager::loadPost($p1->getId());
     if ($com !== false && $post !== false) {
         $com = PostManager::removeComment($com);
         $post = PostManager::loadPost($post->getID());
         $com = PostManager::loadComment($com->getID());
         if ($post !== false && $com === false) {
             if (count($post->getComments()) == 0) {
                 return "<br />Comment deleting test passed";
             }
         }
     }
     return "<br />Comment deleting test NOT PASSED: not deleted";
 }