fileSystemRoot/lib/subscriptions/Subscription.inc");
echo "Testing creation of new folder subscription object
";
$oFolderSubscription = & new Subscription(1, 1, SubscriptionConstants::subscriptionType("FolderSubscription"));
if (isset($oFolderSubscription)) {
echo "Passed folder subscription creation test
";
echo "Testing getting and setting of values
";
echo "Current value of primary key: " . $oFolderSubscription->getID() . "
";
echo "This value CANNOT be altered manually
";
echo "Current value of folder subscription user id: " . $oFolderSubscription->getUserID() . "
";
echo "Setting folder subscription user id to: 23
";
$oFolderSubscription->setUserID(23);
echo "New value of folder subscription user id: " . $oFolderSubscription->getUserID() . "
";
echo "Current value of folder subscription folder id: " . $oFolderSubscription->getExternalID() . "
";
echo "Setting folder subscription folder id to 56
";
$oFolderSubscription->getExternalID(56);
echo "New folder subscription folder id: " . $oFolderSubscription->getExternalID() . "
";
echo "Testing storing of object in database
";
if ($oFolderSubscription->create()) {
echo "Passed storing of object in database test
";
echo "Testing object updating
";
if ($oFolderSubscription->update()) {
echo "Passed object updating test
";
echo "Testing getting of object from database using primary key
";
$oNewFolderSubscription = & Subscription::get($oFolderSubscription->getID(), SubscriptionConstants::subscriptionType("FolderSubscription"));
if (isset($oNewFolderSubscription)) {
echo "
" . arrayToString($oNewFolderSubscription) . "
";
echo "Passed getting of object from db using primary key
";
echo "Testing deletion of object from database
";
if ($oFolderSubscription->delete()) {
echo "Passed deletion of object from database test.
END OF UNIT TEST";
} else {
echo "Failed deletion of object from database test(" . $_SESSION["errorMessage"] . ")";
}
} else {
echo "Failed getting of object test(" . $_SESSION["errorMessage"] . ").
Tests not run (a)deletion of object
";
}
} else {
echo "Failed object updating test(" . $_SESSION["errorMessage"] . ").
Tests not run (a)deletion of object (b)getting of object using id
";
}
} else {
echo "Failed storing of object in database test (" . $_SESSION["errorMessage"] . ").
Tests not run (a)updating of object (b)deletion of object (c)getting of object using id
";
}
} else {
echo "Failed folder subscription creation tests(" . $_SESSION["errorMessage"] . ").
Tests not run: (a)setting/getting of values (b)storing of object (c)updating of object (d)deletion of object (e)getting of object using id
";
}
echo "
";
echo "Testing creation of new document subscription object
";
$oDocumentSubscription = & new Subscription(1, 1, SubscriptionConstants::subscriptionType("DocumentSubscription"));
if (isset($oDocumentSubscription)) {
echo "Passed document subscription creation test
";
echo "Testing getting and setting of values
";
echo "Current value of primary key: " . $oDocumentSubscription->getID() . "
";
echo "This value CANNOT be altered manually
";
echo "Current value of document subscription user id: " . $oDocumentSubscription->getUserID() . "
";
echo "Setting document subscription user id to: 12
";
$oDocumentSubscription->setUserID(12);
echo "New value of document subscription user id: " . $oDocumentSubscription->getUserID() . "
";
echo "Current value of document subscription document id: " . $oDocumentSubscription->getExternalID() . "
";
echo "Setting document subscription document id to 34
";
$oDocumentSubscription->getExternalID(34);
echo "New document subscription document id: " . $oDocumentSubscription->getExternalID() . "
";
echo "Testing storing of object in database
";
if ($oDocumentSubscription->create()) {
echo "Passed storing of object in database test
";
echo "Testing object updating
";
if ($oDocumentSubscription->update()) {
echo "Passed object updating test
";
echo "Testing getting of object from database using primary key
";
$oNewDocumentSubscription = & Subscription::get($oDocumentSubscription->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"));
if (isset($oNewDocumentSubscription)) {
echo " " . arrayToString($oNewDocumentSubscription) . "
";
echo "Passed getting of object from db using primary key
";
echo "Testing deletion of object from database
";
if ($oDocumentSubscription->delete()) {
echo "Passed deletion of object from database test.
END OF UNIT TEST";
} else {
echo "Failed deletion of object from database test";
}
} else {
echo "Failed getting of object test.
Tests not run (a)deletion of object
";
}
} else {
echo "Failed object updating test.
Tests not run (a)deletion of object (b)getting of object using id
";
}
} else {
echo "Failed storing of object in database test.
Tests not run (a)updating of object (b)deletion of object (c)getting of object using id
";
}
} else {
echo "Failed document subscription creation tests.
Tests not run: (a)setting/getting of values (b)storing of object (c)updating of object (d)deletion of object (e)getting of object using id
";
}
}
?>