Add test for testData::getNewestTestIdFromVersionId()

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-03 00:05:35 +00:00
committed by WineHQ
parent 2d9f73340d
commit eeaf2c3642
2 changed files with 53 additions and 0 deletions

View File

@@ -31,6 +31,8 @@ echo "\n";
include_once("test_om_objects.php");
echo "\n";
include_once("test_appData.php");
echo "\n";
include_once("test_testData.php");
if($bTestSuccess == true)
{

View File

@@ -0,0 +1,51 @@
<?php
require_once("path.php");
require_once(BASE."include/version.php");
function test_testData_getNewestTestidFromVersionId()
{
test_start(__FUNCTION__);
global $test_email, $test_password;
if(!$oUser = create_and_login_user())
{
echo "Failed to create and log in user\n";
return FALSE;
}
$iVersionId = 65555;
$oOldTestData = new testData();
$oOldTestData->iVersionId = $iVersionId;
$oOldTestData->create();
$oNewTestData = new testData();
$oNewTestData->iVersionId = $iVersionId;
$oNewTestData->create();
$oUser->addPriv("admin");
$oOldTestData->unQueue();
/* Now the oldTestData should be listed as current, because the new one is queued */
$iExpected = $oOldTestData->iTestingId;
$iReceived = testData::getNewestTestidFromVersionId($iVersionId);
if($iExpected != $iReceived)
{
echo "Got testData id of $iReceived instead of $iExpected!\n";
$oOldTestData->delete();
$oNewTestData->delete();
return FALSE;
}
$oOldTestData->delete();
$oNewTestData->delete();
return TRUE;
}
if(!test_testData_getNewestTestidFromVersionId())
{
echo "test_testData_getNewestTestidFromVersionId() failed!\n";
$bTestSuccess = false;
} else
echo "test_testData_getNewestTestidFromVersionId() passed\n";
?>