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 */ //if (checkSession()) { // test creation of a dashboard news item echo "Testing dashboard news creation
"; // convert the image to a string $sTestImage = "c:\test.jpg"; // TODO: implement //$sImgStr = DashboardNews::imageToString($sTestImage); $sImgStr = $sTestImage; $oNews = & new DashboardNews("test synopsis", "test body", 1, $sImgStr); if (isset($oNews)) { echo "Passed dashboard news creation test

"; 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 img: " . $oNews->getImage() . "
"; echo "Setting news img to 'foo'
"; $oNews->setImage('foo'); echo "New news img: " . $oNews->getImage() . "

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

"; 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',10)"; $oNews->setSynopsis("a"); $oNews->setBody("b"); $oNews->setImage("c"); $oNews->setRank(10); if ($oNews->update()) { echo "Passed dashboard news update test
"; } 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
"; } //} ?>