From eeaf2c3642c37033a9b163ed6a8b8d76002e6160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Tue, 3 Apr 2007 00:05:35 +0000 Subject: [PATCH] Add test for testData::getNewestTestIdFromVersionId() --- unit_test/run_tests.php | 2 ++ unit_test/test_testData.php | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 unit_test/test_testData.php diff --git a/unit_test/run_tests.php b/unit_test/run_tests.php index d374041..ff8b022 100644 --- a/unit_test/run_tests.php +++ b/unit_test/run_tests.php @@ -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) { diff --git a/unit_test/test_testData.php b/unit_test/test_testData.php new file mode 100644 index 0000000..3802fcb --- /dev/null +++ b/unit_test/test_testData.php @@ -0,0 +1,51 @@ +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"; +?>