Alex Băluț : Updated test_appData, because using downloadurl objects does not work anymore, because appData. listSubmittedBy() ignores queued downloadurls
Alexander Nicolaysen Sørnes
asornes at winehq.org
Mon Jun 21 17:02:38 CDT 2010
Module: appdb
Branch: master
Commit: dcc72bf43f35d6a575ec2c884392dd5ac00fe86e
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=dcc72bf43f35d6a575ec2c884392dd5ac00fe86e
Author: Alex Băluț <alexandru.balut at gmail.com>
Date: Mon Jun 21 23:12:27 2010 +0200
Updated test_appData, because using downloadurl objects does not work anymore, because appData.listSubmittedBy() ignores queued downloadurls
---
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;
}
More information about the wine-cvs
mailing list