"; $aClasses = array("archiving/ArchiveRestorationRequest" => array("DocumentID", "RequestUserID", "AdminUserID", "DateTime"), "archiving/DocumentArchiving" => array("DocumentID", "ArchivingSettingsID"), "archiving/TimeUnit" => array("Name"), "archiving/ArchivingType" => array("Name"), "archiving/TimePeriod" => array("TimeUnitID", "Units"), "archiving/ArchivingSettings" => array("ArchivingTypeID", "ExpirationDate", "DocumentTransactionID", "TimePeriodID")); $aInitialValues = array("1,2,3", "1,3", "hour", "\"blah's\"", "1, 10", "2, \"2005-15-15\", 5, 1"); $aSetValues = array(array(4,5,6,"2010-10-10"), array(9,8,7), array("minute"), array("fooblar's"), array(2,20), array(3, "2001-02-03", -1, 4)); $count = 0; $aTestClasses = array("ArchivingSettings"); foreach ($aClasses as $classPath => $aMethodList) { $aClassPath = explode("/", $classPath); $className = $aClassPath[count($aClassPath)-1]; if (in_array($className, $aTestClasses)) { require_once("$default->fileSystemRoot/lib/$classPath.inc"); $constructor = "\$oClass = new $className($aInitialValues[$count]);"; echo "$className- $constructor
"; echo "Testing creation
"; eval($constructor); if (isset($oClass)) { echo "Passed creation test

"; echo "Testing storage
"; if ($oClass->create()) { echo "Passed storage test

"; //$oClass->iId = -1;$oClass->create(); echo "Testing setting and getting of values
"; $i=0; foreach ($aMethodList as $method) { $getter = "get$method"; $setter = "set$method"; echo "Current $method: " . $oClass->$getter() . "
"; echo "Setting $method to: " . $aSetValues[$count][$i] . "
"; $oClass->$setter($aSetValues[$count][$i]); echo "New $method: " . $oClass->$getter() . "

"; $i++; } echo "Testing update
"; if ($oClass->update()) { echo "Passed update test

"; echo "Testing retrieval
"; $get = "\$oNewClass = $className::get(1);"; eval($get); if ($oNewClass) { echo "Passed retrieval test:\n" . arrayToString($oNewClass) . "
"; } else { echo "Failed retrieval test.
"; } echo "Testing array retrieval
"; $getList = "\$aNewClass = $className::getList();"; eval($getList); echo "array=\n" . arrayToString($aNewClass) . "

"; echo "Testing deletion
"; if ($oClass->delete()) { echo "Passed deletion test
"; } else { echo "Failed deletion test"; } } else { echo "Failed update test
"; echo "Tests NOT run: (a) retrieval by id (b) array list retrieval (c) deletion
"; } } else { echo "Failed storage test
"; echo "Tests NOT run: (a) update (b) retrieval by id (c) array list retrieval (d) deletion
"; } } else { echo "Failed creation test
"; echo "Tests NOT run: (a)getting and setting (b) storage (c) retrieval by id (d) array list retrieval (e) deletion
"; } } else { echo "skipping $className"; } $count++; echo "
"; } echo ""; ?>