[APPDB] Updated test_appData, because using downloadurl objects does not work anymore, because appData.listSubmittedBy() ignores queued downloadurls

Alexandru Băluț alexandru.balut at gmail.com
Mon Jun 21 16:20:58 CDT 2010


-------------- next part --------------
From a0bc2a182096a4a3cb4245ed0bcfb5e220c4db40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20B=C4=83lu=C8=9B?= <alexandru.balut at gmail.com>
Date: Mon, 21 Jun 2010 23:12:27 +0200
Subject: Updated test_appData, because using downloadurl objects does not work anymore, because appData.listSubmittedBy() ignores queued downloadurls
To: wine-patches <alexandru.balut at gmail.com>
Reply-To: wine-devel <wine-devel at winehq.org>

---
 unit_test/test_appData.php |   65 ++++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/unit_test/test_appData.php b/unit_test/test_appData.php
index 335a642..ba62234 100644
--- a/unit_test/test_appData.php
+++ b/unit_test/test_appData.php
@@ -3,7 +3,7 @@
 require_once("path.php");
 require_once("test_common.php");
 require_once(BASE."include/appData.php");
-require_once(BASE."include/downloadurl.php");
+require_once(BASE."include/url.php");
 
 function test_appData_listSubmittedBy()
 {
@@ -19,38 +19,45 @@ function test_appData_listSubmittedBy()
         return FALSE;
     }
 
-    /* Create a queued appData entry */
-    $oDownloadUrl = new downloadurl;
-
-    $oDownloadUrl->sUrl = "http://www.microsoft.com/windowsmedia";
-    $oDownloadUrl->sDescription = "Download Meida Player";
-    $oDownloadUrl->iVersionId = 1;
-
-    $oDownloadUrl->create();
-
-    $shReturn = appData::listSubmittedBy($oUser->iUserId, true);
-
-    /* This is needed for deleting the entry */
-    $oUser->addPriv("admin");
-
-    /* There should be two lines; one header and one for the downloadurl */
-    $iExpected = 2;
-    $iReceived = substr_count($shReturn, "</tr>");
-    if($iExpected != $iReceived)
+    /* Create a queued Url, which will be stored in the appData table */
+    $oUrl = new Url;
+    $bResult = $oUrl->create("test description", "http://testurl", 1, null, true);
+    if(!$bResult)
     {
-        error("Got $iReceived rows instead of $iExpected.");
         $bSuccess = false;
-    }
-
-    /* Clean up */
-    if(!$oDownloadUrl->purge())
+        error("Failed to create Url");
+    } else
     {
-        $bSuccess = false;
-        error("Failed to delete oDownloadUrl!");
+        $shReturn = appData::listSubmittedBy($oUser->iUserId, true);
+        if(!$shReturn)
+        {
+            $bSuccess = false;
+            error("Got empty list.");
+        } else
+        {
+            /* There should be two lines; one header and one for the linked data */
+            $iExpected = 2;
+            $iReceived = substr_count($shReturn, "</tr>");
+            if($iExpected != $iReceived)
+            {
+                error("Got $iReceived rows instead of $iExpected.");
+                $bSuccess = false;
+            }
+        }
+    
+        /* Clean up */
+        /* This is needed for deleting the entry */
+        $oUser->addPriv("admin");
+    
+        if(!$oUrl->purge())
+        {
+            $bSuccess = false;
+            error("Failed to delete oUrl!");
+        }
+    
+        $oUser->delete();
     }
-
-    $oUser->delete();
-
+    
     return $bSuccess;
 }
 
-- 
1.7.0.4


More information about the wine-patches mailing list