Add initial un-delete support

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-12-12 22:43:22 +01:00
committed by Chris Morgan
parent 5a31b9d5c8
commit 8c7bd3a5e9
28 changed files with 345 additions and 96 deletions

View File

@@ -43,7 +43,7 @@ function test_appData_listSubmittedBy()
}
/* Clean up */
if(!$oDownloadUrl->delete())
if(!$oDownloadUrl->purge())
{
$bSuccess = false;
error("Failed to delete oDownloadUrl!");

View File

@@ -7,7 +7,7 @@ require_once(BASE.'include/version.php');
require_once(BASE.'include/application.php');
require_once("test_common.php");
/* test that Application::delete() properly deletes data dependent on */
/* test that Application::purge() properly deletes data dependent on */
/* having an application */
//TODO: need to test that we delete all urls, maintainers and other things
// tested under an application
@@ -210,9 +210,9 @@ function test_application_getWithRating()
function delete_app_and_user($oApp, $oUser)
{
$bSuccess = true;
if(!$oApp->delete())
if(!$oApp->purge())
{
echo __FUNCTION__."() oApp->delete() failed\n";
echo __FUNCTION__."() oApp->purge() failed\n";
$bSuccess = false;
}

View File

@@ -40,9 +40,9 @@ function delete_version_and_parent_app($iVersionId)
$oVersion = new version($iVersionId);
$oApp = new application($oVersion->iAppId);
if(!$oApp->delete())
if(!$oApp->purge())
{
echo __FUNCTION__."() oApp->delete() failed, returned false!\n";
echo __FUNCTION__."() oApp->purge() failed, returned false!\n";
}
// remove the admin privleges only if the user didn't

View File

@@ -200,7 +200,7 @@ function test_maintainer_getAppsMaintained()
/* remove this application */
$oApp = new Application($iAppId);
$oApp->delete();
$oApp->purge();
$oUser->delete();
@@ -461,7 +461,7 @@ function test_superMaintainerOnAppSubmit()
Maintainer::deleteMaintainer($oUser, $iAppId);
$oApp->delete();
$oApp->purge();
$oUser->delete();
return true;
@@ -549,7 +549,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -560,7 +560,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Got super maintainer count of $iReceived instead of $iExpected!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -569,7 +569,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -608,7 +608,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -619,7 +619,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Got maintainer count of $iReceived instead of $iExpected!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -628,7 +628,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Failed to get list of maintainers!");
$oUser->delete(); // delete the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
@@ -639,12 +639,12 @@ function test_maintainer_getMaintainersForAppIdVersionId()
{
error("Got maintainer count of $iReceived instead of $iExpected!");
$oUser->delete(); // clean up the user
$oApp->delete(); // cleanup the application and its versions we created
$oApp->purge(); // cleanup the application and its versions we created
return FALSE;
}
if(!$oApp->delete())
echo __FUNCTION__." oApp->delete() failed\n";
if(!$oApp->purge())
echo __FUNCTION__." oApp->purge() failed\n";
$oUser->delete(); // clean up the user

View File

@@ -15,7 +15,7 @@ class notifyContainer
function cleanup()
{
$this->oTestData->delete(); // deleted the created testData
$this->oTestData->purge(); // deleted the created testData
$this->oMaintainer->delete(); // delete the created maintainer entry
// (Should be deleted when the user is deleted)

View File

@@ -51,7 +51,7 @@ function test_class($sClassName, $aTestMethods)
{
error("Got '$hResult' instead of a valid query handle");
error("FAILED\t\t$sClassName::$sClassName");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
@@ -59,7 +59,7 @@ function test_class($sClassName, $aTestMethods)
{
error("Failed to fetch query object");
error("FAILED\t\t$sClassName::$sClassName");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
@@ -70,7 +70,7 @@ function test_class($sClassName, $aTestMethods)
{
error("Got '$iReceived' instead of a valid id");
error("FAILED\t\t$sClassName::$sClassName()");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
@@ -83,9 +83,9 @@ function test_class($sClassName, $aTestMethods)
if(!$oUser->addPriv("admin"))
error("oUser->addPriv('admin') failed");
if(!$oTestObject->delete())
if(!$oTestObject->purge())
{
error("sClassName of '".$sClassName."' oTestObject->delete() failed!");
error("sClassName of '".$sClassName."' oTestObject->purge() failed!");
$oUser->delete();
return false;
}
@@ -111,13 +111,13 @@ function test_class($sClassName, $aTestMethods)
{
error("Got $iReceived instead of >= $iExpected");
error("FAILED\t\t$sClassName::$sMethod");
$oTestObject->delete();
$oTestObject->purge();
return FALSE;
}
/* Class specific clean-up */
cleanup($oTestObject);
$oTestObject->delete();
$oTestObject->purge();
echo "PASSED\t\t$sClassName::$sMethod\n";
break;
@@ -150,11 +150,11 @@ function cleanup($oObject)
break;
case "version":
$oApp = new application($oObject->iAppId);
$oApp->delete();
$oApp->purge();
break;
case "version_queue":
$oApp = new application($oObject->oVersion->iAppId);
$oApp->delete();
$oApp->purge();
break;
}
}
@@ -253,6 +253,7 @@ function test_object_methods()
"canEdit",
"display",
"getOutputEditorValues",
"mustBeQueued",
"objectGetChildren",
"objectGetEntries",
"objectGetHeader",
@@ -264,7 +265,7 @@ function test_object_methods()
"objectMakeLink",
"objectMakeUrl",
"outputEditor",
"mustBeQueued"
"purge"
);
$aTestClasses = array("application",

View File

@@ -35,14 +35,14 @@ function test_testData_getNewestTestidFromVersionId()
if($iExpected != $iReceived)
{
error("Got testData id of $iReceived instead of $iExpected!");
$oOldTestData->delete();
$oNewTestData->delete();
$oOldTestData->purge();
$oNewTestData->purge();
$oUser->delete();
return FALSE;
}
$oOldTestData->delete();
$oNewTestData->delete();
$oOldTestData->purge();
$oNewTestData->purge();
$oUser->delete();
return TRUE;