Fix appData::listSubmittedBy() to run faster. Add a unit test for appData::listSubmittedBy()
This commit is contained in:
committed by
WineHQ
parent
9ef6268fa6
commit
fef587a60e
@@ -26,4 +26,6 @@ echo "\n";
|
||||
include_once("test_url.php");
|
||||
echo "\n";
|
||||
include_once("test_om_objects.php");
|
||||
echo "\n";
|
||||
include_once("test_appData.php");
|
||||
?>
|
||||
|
||||
51
unit_test/test_appData.php
Normal file
51
unit_test/test_appData.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once("path.php");
|
||||
require_once("test_common.php");
|
||||
require_once(BASE."include/appData.php");
|
||||
require_once(BASE."include/downloadurl.php");
|
||||
|
||||
function test_appData_listSubmittedBy()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
/* There should be two lines; one header and one for the downloadurl */
|
||||
$iExpected = 2;
|
||||
$iReceived = substr_count($shReturn, "</tr>");
|
||||
if($iExpected != $iReceived)
|
||||
{
|
||||
echo "Got $iReceived rows instead of $iExpected.\n";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
$oDownloadUrl->delete();
|
||||
$oUser->delete();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(!test_appData_listSubmittedBy())
|
||||
echo "test_appData_listSubmittedBy() failed!\n";
|
||||
else
|
||||
echo "test_appData_listSubmittedBy() passed\n";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user