appdb/unit_test run_tests.php test_url.php

WineHQ wineowner at wine.codeweavers.com
Thu Jan 18 19:41:01 CST 2007


ChangeSet ID:	30892
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/01/18 19:41:01

Modified files:
	unit_test      : run_tests.php 
Added files:
	unit_test      : test_url.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Unit test for url::update()

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

Old revision  New revision  Changes     Path
 1.9           1.10          +2 -0       appdb/unit_test/run_tests.php
 Added         1.1           +0 -0       appdb/unit_test/test_url.php

Index: appdb/unit_test/run_tests.php
diff -u -p appdb/unit_test/run_tests.php:1.9 appdb/unit_test/run_tests.php:1.10
--- appdb/unit_test/run_tests.php:1.9	19 Jan 2007  1:41: 1 -0000
+++ appdb/unit_test/run_tests.php	19 Jan 2007  1:41: 1 -0000
@@ -22,4 +22,6 @@ echo "\n";
 include_once("test_error_log.php");
 echo "\n";
 include_once("test_filter.php");
+echo "\n";
+include_once("test_url.php");
 ?>
Index: appdb/unit_test/test_url.php
diff -u -p /dev/null appdb/unit_test/test_url.php:1.1
--- /dev/null	19 Jan 2007  1:41: 1 -0000
+++ appdb/unit_test/test_url.php	19 Jan 2007  1:41: 1 -0000
@@ -0,0 +1,73 @@
+<?php
+
+/* Unit tests for functions in include/url.php */
+
+require_once("path.php");
+require_once("test_common.php");
+
+function test_url_update()
+{
+    test_start(__FUNCTION__);
+
+    global $test_email, $test_password;
+
+    $bSuccess = true; // default to success until we detect failure
+
+    /* Log in */
+    $oUser = new User();
+    if($retval = $oUser->login($test_email, $test_password) != SUCCESS)
+    {
+        echo "Received '$retval' instead of SUCCESS('".SUCCESS."').";
+        return FALSE;
+    }
+
+    $iAppId = 655000;
+    $iVersionId = 655000;
+
+    $oUser->addPriv("admin");
+
+    $oUrl = new Url();
+    $oUrl->create("Bad description", "http://www.badurl.com/", $iVersionId, $iAppId, TRUE);
+
+    $sDescriptionNew = "Good description";
+    $sUrlNew = "http://www.goodurl.com/";
+    $iAppIdNew = $iAppId + 1;
+    $iVersionIdNew = $iVersionId + 1;
+
+    $oUrl->update($sDescriptionNew, $sUrlNew, $iVersionIdNew, $iAppIdNew, TRUE);
+
+    if($oUrl->sDescription != $sDescriptionNew)
+    {
+        echo "Description is '$oUrl->sDescription' instead of '$sDescriptionNew'\n";
+        $bSuccess = false;
+    }
+
+    if($oUrl->sUrl != $sUrlNew)
+    {
+        echo "Url is '$oUrl->sUrl' instead of '$sUrlNew'\n";
+        $bSuccess = false;
+    }
+
+    if($oUrl->iVersionId != $iVersionIdNew)
+    {
+        echo "VersionId is '$oUrl->iVersionId' instead of '$iVersionIdNew'\n";
+        $bSuccess = false;
+    }
+
+    if($oUrl->iAppId != $iAppIdNew)
+    {
+        echo "AppId is '$oUrl->iAppId' instead of '$iAppIdNew'\n";
+        $bSuccess = false;
+    }
+
+    $oUrl->delete(TRUE);
+
+    return $bSuccess;
+}
+
+if(!test_url_update())
+    echo "test_url_update() failed!\n";
+else
+    echo "test_url_update() passed\n";
+
+?>



More information about the wine-cvs mailing list