Unit test cleanups. Fixes tests so they don't leave left over entries in the database. Add a
check to ensure that row counts in most tables are unchanged from the start and end of the tests. Refactor some code.
This commit is contained in:
@@ -231,6 +231,8 @@ class Application {
|
||||
*/
|
||||
function delete($bSilent=false)
|
||||
{
|
||||
$bSuccess = true;
|
||||
|
||||
/* make sure the current user has the appropriate permission to delete
|
||||
this application */
|
||||
if(!$_SESSION['current']->canDeleteApplication($this))
|
||||
@@ -246,10 +248,10 @@ class Application {
|
||||
{
|
||||
$iVersionId = $oRow->versionId;
|
||||
$oVersion = new Version($iVersionId);
|
||||
$oVersion->delete($bSilent);
|
||||
if(!$oVersion->delete($bSilent))
|
||||
$bSuccess = false; // return false, deleting the version failed
|
||||
}
|
||||
|
||||
|
||||
/* fetch urlsIds */
|
||||
$aUrlsIds = array();
|
||||
$sQuery = "SELECT id
|
||||
@@ -289,7 +291,7 @@ class Application {
|
||||
if(!$bSilent)
|
||||
$this->SendNotificationMail("delete");
|
||||
|
||||
return true;
|
||||
return $bSuccess;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -229,10 +229,9 @@ class downloadurl
|
||||
|
||||
function canEdit($iVersionId = NULL)
|
||||
{
|
||||
$oUser = new User($_SESSION['current']->iUserId);
|
||||
|
||||
if($oUser->hasPriv("admin") || ($iVersionId &&
|
||||
maintainer::isUserMaintainer($oUser, $iVersionId)))
|
||||
if($_SESSION['current']->hasPriv("admin") ||
|
||||
($iVersionId &&
|
||||
maintainer::isUserMaintainer($_SESSION['current'], $iVersionId)))
|
||||
{
|
||||
return TRUE;
|
||||
} else
|
||||
|
||||
@@ -128,6 +128,8 @@ class screenshot
|
||||
/**
|
||||
* Deletes the screenshot from the database.
|
||||
* and request its deletion from the filesystem (including the thumbnail).
|
||||
*
|
||||
* Returns: true if deletion was success, false if otherwise
|
||||
*/
|
||||
function delete($bSilent=false)
|
||||
{
|
||||
@@ -155,6 +157,8 @@ class screenshot
|
||||
{
|
||||
$this->mailSubmitter(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function reject()
|
||||
|
||||
Reference in New Issue
Block a user