示例#1
0
 function testDirectory()
 {
     $data = $this->mail_data;
     $mail = MailManager::createMail($data);
     $dir = MailManager::createDirectory($this->dir_name, $this->author_id);
     //echo "<p>" . $mail . "<br />" . $dir . "</p>"; //DEBUG
     if ($dir == null || $dir === false) {
         return "<br />Directory test NOT PASSED: not created";
     }
     if ($dir->getOwner() != $this->author_id) {
         return "<br />Directory test NOT PASSED: owner";
     }
     if ($dir->getName() != $this->dir_name) {
         return "<br />Directory test NOT PASSED: name";
     }
     $dir2 = MailManager::loadDirectory($dir->getID());
     //echo "<p>" . $dir . "<br />" . $dir2 . "</p>"; //DEBUG
     if ($dir2 === false) {
         return "<br />Directory test NOT PASSED: not saved";
     }
     if ($dir->getOwner() != $dir2->getOwner()) {
         return "<br />Directory test NOT PASSED: not saved owner";
     }
     if ($dir->getName() != $dir2->getName()) {
         return "<br />Directory test NOT PASSED: not saved name";
     }
     $dir = MailManager::addMailToDir($mail, $dir);
     $dir2 = MailManager::loadDirectory($dir->getID());
     //echo "<p>" . $dir . "<br />" . $dir2 . "</p>"; //DEBUG
     if ($dir2 === false) {
         return "<br />Directory test NOT PASSED: not updated";
     }
     if ($dir->getMails() != $dir2->getMails()) {
         return "<br />Directory test NOT PASSED: not updated mails";
     }
     $dir = MailManager::editDirectory($dir, $this->dir_name2);
     $dir2 = MailManager::loadDirectory($dir->getID());
     //echo "<p>" . $dir . "<br />" . $dir2 . "</p>"; //DEBUG
     if ($dir2 === false) {
         return "<br />Directory test NOT PASSED: not updated";
     }
     if ($dir->getName() != $dir2->getName()) {
         return "<br />Directory test NOT PASSED: not updated name";
     }
     return "<br />Directory test passed";
 }