test_om_objects: Test unQueue()
This commit is contained in:
committed by
Chris Morgan
parent
663894bed4
commit
1f081f4be1
@@ -259,6 +259,11 @@ class application_queue
|
|||||||
return $sErrors;
|
return $sErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return $this->oApp->objectGetState();
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
return $this->oApp->canEdit();
|
return $this->oApp->canEdit();
|
||||||
|
|||||||
@@ -462,6 +462,11 @@ class Bug
|
|||||||
return $sLink;
|
return $sLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return ($this->bQueued) ? 'queued' : 'accepted';
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
|
|||||||
@@ -249,6 +249,11 @@ class downloadurl
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return ($this->bQueued) ? 'queued' : 'accepted';
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit($iVersionId = NULL)
|
function canEdit($iVersionId = NULL)
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin") ||
|
if($_SESSION['current']->hasPriv("admin") ||
|
||||||
|
|||||||
@@ -675,6 +675,11 @@ class maintainer
|
|||||||
echo "</td></tr></table></div>\n\n";
|
echo "</td></tr></table></div>\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return $this->sState;
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin") || $this->iUserId == $_SESSION['current']->iUserId)
|
if($_SESSION['current']->hasPriv("admin") || $this->iUserId == $_SESSION['current']->iUserId)
|
||||||
|
|||||||
@@ -107,6 +107,11 @@ class Monitor {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unQueue()
|
||||||
|
{
|
||||||
|
return true; // We don't queue monitors
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetSubmitterId()
|
function objectGetSubmitterId()
|
||||||
{
|
{
|
||||||
return $this->iUserId;
|
return $this->iUserId;
|
||||||
@@ -226,6 +231,12 @@ class Monitor {
|
|||||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
// We don't queue monitors
|
||||||
|
return 'accepted';
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin") ||
|
if($_SESSION['current']->hasPriv("admin") ||
|
||||||
|
|||||||
@@ -77,6 +77,11 @@ class Note {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function unQueue()
|
||||||
|
{
|
||||||
|
return true; // We don't queue notes
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update note.
|
* Update note.
|
||||||
* Returns true on success and false on failure.
|
* Returns true on success and false on failure.
|
||||||
@@ -372,6 +377,11 @@ class Note {
|
|||||||
return $sLink;
|
return $sLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return 'accepted'; // We don't queue notes
|
||||||
|
}
|
||||||
|
|
||||||
// users can edit the note if they:
|
// users can edit the note if they:
|
||||||
// - have "admin" privileges
|
// - have "admin" privileges
|
||||||
// - maintain the version, or supermaintain the application that
|
// - maintain the version, or supermaintain the application that
|
||||||
|
|||||||
@@ -665,6 +665,11 @@ class screenshot
|
|||||||
return appData::objectGetHeader("screenshot");
|
return appData::objectGetHeader("screenshot");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return ($this->bQueued) ? 'queued' : 'accepted';
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
if($this)
|
if($this)
|
||||||
|
|||||||
@@ -122,6 +122,11 @@ class testData_queue
|
|||||||
return $this->oTestData->checkOutputEditorInput($aClean);
|
return $this->oTestData->checkOutputEditorInput($aClean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return $this->oTestData->objectGetState();
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
return $this->oTestData->canEdit();
|
return $this->oTestData->canEdit();
|
||||||
|
|||||||
@@ -205,6 +205,11 @@ class version_queue
|
|||||||
return $sErrors;
|
return $sErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetState()
|
||||||
|
{
|
||||||
|
return $this->oVersion->objectGetState();
|
||||||
|
}
|
||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
return $this->oVersion->canEdit();
|
return $this->oVersion->canEdit();
|
||||||
|
|||||||
@@ -119,6 +119,30 @@ function test_class($sClassName, $aTestMethods)
|
|||||||
cleanup($oTestObject);
|
cleanup($oTestObject);
|
||||||
$oTestObject->purge();
|
$oTestObject->purge();
|
||||||
|
|
||||||
|
echo "PASSED\t\t$sClassName::$sMethod\n";
|
||||||
|
break;
|
||||||
|
case 'unQueue':
|
||||||
|
$bSuccess = true;
|
||||||
|
$oTestObject = create_object($sClassName, $oUser, false);
|
||||||
|
|
||||||
|
$oUser->addPriv('admin');
|
||||||
|
$oTestObject->unQueue();
|
||||||
|
|
||||||
|
$iReceived = $oTestObject->objectGetState();
|
||||||
|
$iExpected = 'accepted';
|
||||||
|
if($iReceived != $iExpected)
|
||||||
|
{
|
||||||
|
error("Got queue state of $iReceived instead of $iExpected\n");
|
||||||
|
error("FAILED\t\t$sClassName::$sMethod");
|
||||||
|
$bSuccess = false;
|
||||||
|
}
|
||||||
|
cleanup($oTestObject);
|
||||||
|
$oTestObject->purge();
|
||||||
|
$oUser->delPriv('admin');
|
||||||
|
|
||||||
|
if(!$bSuccess)
|
||||||
|
return $bSuccess;
|
||||||
|
|
||||||
echo "PASSED\t\t$sClassName::$sMethod\n";
|
echo "PASSED\t\t$sClassName::$sMethod\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -159,9 +183,11 @@ function cleanup($oObject)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_object($sClassName, $oUser)
|
function create_object($sClassName, $oUser, $bAsAdmin = true)
|
||||||
{
|
{
|
||||||
|
if($bAsAdmin)
|
||||||
$oUser->addPriv("admin");
|
$oUser->addPriv("admin");
|
||||||
|
|
||||||
$oTestObject = new $sClassName();
|
$oTestObject = new $sClassName();
|
||||||
/* Set up one test entry, depending on class */
|
/* Set up one test entry, depending on class */
|
||||||
switch($sClassName)
|
switch($sClassName)
|
||||||
@@ -188,7 +214,15 @@ function create_object($sClassName, $oUser)
|
|||||||
$oTestObject->iVersionId = create_version_and_parent_app("create_object_downloadurl");
|
$oTestObject->iVersionId = create_version_and_parent_app("create_object_downloadurl");
|
||||||
break;
|
break;
|
||||||
case "maintainer":
|
case "maintainer":
|
||||||
|
/* We create the version as admin anyway to avoid the maintainer entry getting a state of 'pending' */
|
||||||
|
if(!$bAsAdmin)
|
||||||
|
$oUser->addPriv('admin');
|
||||||
|
|
||||||
$iVersionId = create_version_and_parent_app("create_object_maintainer");
|
$iVersionId = create_version_and_parent_app("create_object_maintainer");
|
||||||
|
|
||||||
|
if(!$bAsAdmin)
|
||||||
|
$oUser->delPriv('admin');
|
||||||
|
|
||||||
$oVersion = new version($iVersionId);
|
$oVersion = new version($iVersionId);
|
||||||
$oTestObject->iUserId = $oUser->iUserId;
|
$oTestObject->iUserId = $oUser->iUserId;
|
||||||
$oTestObject->iAppId = $oVersion->iAppId;
|
$oTestObject->iAppId = $oVersion->iAppId;
|
||||||
@@ -242,6 +276,9 @@ function create_object($sClassName, $oUser)
|
|||||||
$oTestObject->iScreenshotId = query_appdb_insert_id();
|
$oTestObject->iScreenshotId = query_appdb_insert_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($bAsAdmin)
|
||||||
|
$oUser->delPriv('admin');
|
||||||
|
|
||||||
return $oTestObject;
|
return $oTestObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,12 +297,14 @@ function test_object_methods()
|
|||||||
"objectGetId",
|
"objectGetId",
|
||||||
"objectGetMail",
|
"objectGetMail",
|
||||||
"objectGetMailOptions",
|
"objectGetMailOptions",
|
||||||
|
'objectGetState',
|
||||||
"objectGetSubmitterId",
|
"objectGetSubmitterId",
|
||||||
"objectGetTableRow",
|
"objectGetTableRow",
|
||||||
"objectMakeLink",
|
"objectMakeLink",
|
||||||
"objectMakeUrl",
|
"objectMakeUrl",
|
||||||
"outputEditor",
|
"outputEditor",
|
||||||
"purge"
|
'purge',
|
||||||
|
'unQueue'
|
||||||
);
|
);
|
||||||
|
|
||||||
$aTestClasses = array("application",
|
$aTestClasses = array("application",
|
||||||
|
|||||||
Reference in New Issue
Block a user