fileSystemRoot/lib/dashboard/DashboardNews.inc"); /** * $Id$ * * Unit Tests for lib/dashboard/DashboardNews.inc * includes tests for: * o creation of document object * o setting/getting of values * o storing of object * o updating of object * o deletion of object * * Licensed under the GNU GPL. For full terms see the file COPYING. * * @version $Revision$ * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package tests.dashboard */ $sTestImage = "c:/test.gif"; if (isset($fViewImage)) { $oNews = & new DashboardNews("test synopsis", "test body", 1, $sTestImage); $oNews->displayImage(); } else { // test creation of a dashboard news item echo "Testing dashboard news creation
"; $oNews = & new DashboardNews("test synopsis", "test body", 1); if (isset($oNews)) { echo "Passed dashboard news creation test

"; echo "Testing image retrieval
"; echo "
"; echo "Testing setting and getting of dashboard news values
"; echo "Current dashboard synopsis: " . $oNews->getSynopsis() . "
"; echo "Setting synopsis to: blah
"; $oNews->setSynopsis("blah"); echo "New synopsis: " . $oNews->getSynopsis() . "

"; echo "Current news body: " . $oNews->getBody() . "
"; echo "Setting news body to: 'blurg'
"; $oNews->setBody("blurg"); echo "New news body: " . $oNews->getBody() . "

"; echo "Current news rank: " . $oNews->getRank() . "
"; echo "Set new rank to 5
"; $oNews->setRank(5); echo "New new rank: " . $oNews->getRank() . "

"; echo "Current image size: " . $oNews->getImageSize() . "
"; echo "Current image mime type id: " . $oNews->getImageMimeTypeID() . "
"; echo "Testing dashboard news storage
"; if ($oNews->create()) { echo "Passed dashboard news storage test

"; echo "Testing dashboard news update
"; echo "setting attributes to ('a','b','c:\sample.jpg',10)"; $oNews->setSynopsis("a"); $oNews->setBody("b"); //$oNews->setImageFile("c:/test.gif"); $oNews->setRank(10); if ($oNews->update()) { echo "Passed dashboard news update test
"; echo "Testing dashboard news retrieval
"; $oRetrievedNews = DashboardNews::get($oNews->getID()); if ($oRetrievedNews) { echo "Passed dashboard news retrieval test

"; echo "id=" . $oRetrievedNews->getID() . "
"; } } else { echo "Failed dashboard news update test: " . $_SESSION["errorMessage"]; } /* echo "Testing dashboard news deletion
"; if ($oNews->delete()) { echo "Passed dashboard news deletion test
"; } else { echo "Failed dashboard news deletion test: " . $_SESSION["errorMessage"]; } */ } else { echo "Failed dashboard news storage test: " . $_SESSION["errorMessage"] . "
"; echo "Tests NOT run: (a)dashboard news deletion (b) dashboard news update
"; } } else { echo "Failed dashboard news creation test
"; echo "Tests NOT run: (a)getting and setting (b)dashboard news storage (c)dashboard news deletion
"; } } ?>