Disallowid of 0 in deleteMaintainersForVersion(). Add a unit test to ensure that
deleteMaintainersForVersion() behaves properly.
This commit is contained in:
committed by
WineHQ
parent
3172aec739
commit
83164089ae
@@ -178,6 +178,9 @@ class maintainer
|
|||||||
|
|
||||||
function deleteMaintainersForVersion($oVersion)
|
function deleteMaintainersForVersion($oVersion)
|
||||||
{
|
{
|
||||||
|
if(!$oVersion->iVersionId)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
$hResult = query_parameters("DELETE from appMaintainers WHERE versionId='?'",
|
$hResult = query_parameters("DELETE from appMaintainers WHERE versionId='?'",
|
||||||
$oVersion->iVersionId);
|
$oVersion->iVersionId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,6 +305,38 @@ function test_superMaintainerOnAppSubmit()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* deleteMaintainersForVersion() should fail if versionId = 0
|
||||||
|
Otherwise it will delete all super maintainers */
|
||||||
|
function test_maintainer_deleteMaintainersForVersion()
|
||||||
|
{
|
||||||
|
test_start(__FUNCTION__);
|
||||||
|
|
||||||
|
global $test_email, $test_password;
|
||||||
|
|
||||||
|
$oUser = new user();
|
||||||
|
$oUser->login($test_email, $test_password);
|
||||||
|
|
||||||
|
$oMaintainer = new maintainer();
|
||||||
|
$oMaintainer->iAppId = 655000;
|
||||||
|
$oMaintainer->iVersionId = 0;
|
||||||
|
$oMaintainer->iUserId = 655000;
|
||||||
|
$oMaintainer->sMaintainReason = "Silly reason";
|
||||||
|
$oMaintainer->bSuperMaintainer = 1;
|
||||||
|
|
||||||
|
$oMaintainer->create();
|
||||||
|
|
||||||
|
$oVersion = new version();
|
||||||
|
$oVersion->iVersionId = 0;
|
||||||
|
|
||||||
|
if(maintainer::deleteMaintainersForVersion($oVersion) !== FALSE)
|
||||||
|
{
|
||||||
|
echo "Got success, but this should fail.\n";
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if(!test_maintainer_getMaintainerCountForUser())
|
if(!test_maintainer_getMaintainerCountForUser())
|
||||||
echo "test_maintainer_getMaintainerCountForUser() failed!\n";
|
echo "test_maintainer_getMaintainerCountForUser() failed!\n";
|
||||||
else
|
else
|
||||||
@@ -327,4 +359,9 @@ if(!test_superMaintainerOnAppSubmit())
|
|||||||
else
|
else
|
||||||
echo "test_superMaintainerOnAppSubmit() passed\n";
|
echo "test_superMaintainerOnAppSubmit() passed\n";
|
||||||
|
|
||||||
|
if(!test_maintainer_deleteMaintainersForVersion())
|
||||||
|
echo "test_maintainer_deleteMaintainersForVersion() failed!\n";
|
||||||
|
else
|
||||||
|
echo "test_maintainer_deleteMaintianersForVersion() passed\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user