appdb/unit_test test_testData.php

WineHQ wineowner at wine.codeweavers.com
Mon Apr 2 19:06:00 CDT 2007


ChangeSet ID:	31026
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/04/02 19:06:00

Added files:
	unit_test      : test_testData.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add test for testData::getNewestTestIdFromVersionId()

Patch: http://cvs.winehq.org/patch.py?id=31026

Old revision  New revision  Changes     Path
 Added         1.1           +0 -0       appdb/unit_test/test_testData.php

Index: appdb/unit_test/test_testData.php
diff -u -p /dev/null appdb/unit_test/test_testData.php:1.1
--- /dev/null	3 Apr 2007  0: 6: 0 -0000
+++ appdb/unit_test/test_testData.php	3 Apr 2007  0: 6: 0 -0000
@@ -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";
+?>



More information about the wine-cvs mailing list