Test more classes with objectManager
This commit is contained in:
committed by
WineHQ
parent
7f397c1dc4
commit
7d6772b5b1
@@ -825,9 +825,15 @@ class Application {
|
|||||||
return $sResult;
|
return $sResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectMakeUrl()
|
||||||
|
{
|
||||||
|
$sUrl = BASE."appview.php?iAppId=$this->iAppId";
|
||||||
|
return $sUrl;
|
||||||
|
}
|
||||||
|
|
||||||
function objectMakeLink()
|
function objectMakeLink()
|
||||||
{
|
{
|
||||||
$sLink = "<a href=\"".BASE."appview.php?iAppId=$this->iAppId\">".
|
$sLink = "<a href=\"".$this->objectMakeUrl()."\">".
|
||||||
$this->sName."</a>";
|
$this->sName."</a>";
|
||||||
return $sLink;
|
return $sLink;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -601,6 +601,24 @@ class Screenshot {
|
|||||||
{
|
{
|
||||||
return appData::getDefaultReply();
|
return appData::getDefaultReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function display()
|
||||||
|
{
|
||||||
|
/* STUB */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectMakeLink()
|
||||||
|
{
|
||||||
|
/* STUB */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectMakeUrl()
|
||||||
|
{
|
||||||
|
/* STUB */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class testData{
|
|||||||
var $sQueued;
|
var $sQueued;
|
||||||
|
|
||||||
// constructor, fetches the data.
|
// constructor, fetches the data.
|
||||||
function testData($iTestingId = null)
|
function testData($iTestingId = null, $oRow = null)
|
||||||
{
|
{
|
||||||
// we are working on an existing test
|
// we are working on an existing test
|
||||||
if($iTestingId)
|
if($iTestingId)
|
||||||
@@ -895,6 +895,25 @@ class testData{
|
|||||||
echo "<p>To view a submission, click on its name. From that page ".
|
echo "<p>To view a submission, click on its name. From that page ".
|
||||||
"you can submit it into the AppDB, reject it or delete it.</p>\n";
|
"you can submit it into the AppDB, reject it or delete it.</p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function display()
|
||||||
|
{
|
||||||
|
/* STUB */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function objectMakeUrl()
|
||||||
|
{
|
||||||
|
/* STUB */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectMakeLink()
|
||||||
|
{
|
||||||
|
/* STUB */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -4,12 +4,9 @@
|
|||||||
|
|
||||||
require_once("path.php");
|
require_once("path.php");
|
||||||
require_once("test_common.php");
|
require_once("test_common.php");
|
||||||
//require_once(BASE."include/incl.php");
|
|
||||||
require_once(BASE.'include/objectManager.php');
|
require_once(BASE.'include/objectManager.php');
|
||||||
require_once(BASE.'include/application.php');
|
require_once(BASE.'include/application.php');
|
||||||
//require_once(BASE.'include/application_queue.php');
|
|
||||||
require_once(BASE.'include/maintainer.php');
|
require_once(BASE.'include/maintainer.php');
|
||||||
//require_once(BASE.'include/version_queue.php');
|
|
||||||
|
|
||||||
/* internal function */
|
/* internal function */
|
||||||
function test_class($sClassName, $aTestMethods)
|
function test_class($sClassName, $aTestMethods)
|
||||||
@@ -65,12 +62,31 @@ function test_class($sClassName, $aTestMethods)
|
|||||||
$oTestObject->sMaintainReason = "I need it";
|
$oTestObject->sMaintainReason = "I need it";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Should return 1 */
|
|
||||||
if(!$oTestObject->create())
|
/* We cannot use screenshot::create() because it requires an image */
|
||||||
|
if($sClassName != "screenshot")
|
||||||
{
|
{
|
||||||
echo "FAILED\t\t$sClassName::create()\n";
|
if(!$oTestObject->create())
|
||||||
return FALSE;
|
{
|
||||||
|
echo "FAILED\t\t$sClassName::create()\n";
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sQuery = "INSERT INTO appData
|
||||||
|
(versionId, type, description, queued, submitterId)
|
||||||
|
VALUES('?','?','?','?','?')";
|
||||||
|
$hResult = query_parameters($sQuery, 0, "screenshot", "", "false",
|
||||||
|
$oUser->iUserId);
|
||||||
|
if(!$hResult)
|
||||||
|
{
|
||||||
|
echo "FAILED\t\t$sClassName to create screenshot entry";
|
||||||
|
returN FALSE;
|
||||||
|
}
|
||||||
|
$oTestObject->iScreenshotId = mysql_insert_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Should return 1 or more, since there may be entries present already */
|
||||||
$iExpected = 1;
|
$iExpected = 1;
|
||||||
$hResult = $oTestObject->objectGetEntries(false);
|
$hResult = $oTestObject->objectGetEntries(false);
|
||||||
$iReceived = mysql_num_rows($hResult);
|
$iReceived = mysql_num_rows($hResult);
|
||||||
@@ -103,46 +119,6 @@ function test_object_methods()
|
|||||||
{
|
{
|
||||||
test_start(__FUNCTION__);
|
test_start(__FUNCTION__);
|
||||||
|
|
||||||
/* $sClassName = 'application';
|
|
||||||
if(!test_class($sClassName))
|
|
||||||
{
|
|
||||||
echo $sClassName." class does not have valid methods for use with the object manager\n";
|
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo "PASSED:\t\t".$sClassName."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sClassName = 'application_queue';
|
|
||||||
if(!test_class($sClassName))
|
|
||||||
{
|
|
||||||
echo $sClassName." class does not have valid methods for use with the object manager\n";
|
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo "PASSED:\t\t".$sClassName."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sClassName = 'version';
|
|
||||||
if(!test_class($sClassName))
|
|
||||||
{
|
|
||||||
echo $sClassName." class does not have valid methods for use with the object manager\n";
|
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo "PASSED:\t\t".$sClassName."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sClassName = 'version_queue';
|
|
||||||
if(!test_class($sClassName))
|
|
||||||
{
|
|
||||||
echo $sClassName." class does not have valid methods for use with the object manager\n";
|
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
echo "PASSED:\t\t".$sClassName."\n";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$aTestMethods = array("objectGetHeader", "objectOutputTableRow",
|
$aTestMethods = array("objectGetHeader", "objectOutputTableRow",
|
||||||
"objectGetEntries", "display",
|
"objectGetEntries", "display",
|
||||||
"objectGetInstanceFromRow", "outputEditor", "canEdit",
|
"objectGetInstanceFromRow", "outputEditor", "canEdit",
|
||||||
@@ -152,13 +128,23 @@ function test_object_methods()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if(!test_class("vendor", $aTestMethods))
|
if(!test_class("vendor", $aTestMethods))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if(!test_class("maintainer", $aTestMethods))
|
if(!test_class("maintainer", $aTestMethods))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* if(!test_class("screenshot", $aTestMethods))
|
if(!test_class("screenshot", $aTestMethods))
|
||||||
return FALSE; */
|
return FALSE;
|
||||||
|
|
||||||
|
if(!test_class("application", $aTestMethods))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if(!test_class("testData", $aTestMethods))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* if(!test_class("version", $aTestMethods))
|
||||||
|
return FALSE; */
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user