This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
qemudb/unit_test/test_url.php
Chris Morgan e2b15c0566 Keep track of global success or failure and print out a summary success or failure when the
tests are complete. Makes it less likely that a test failure will be missed.
2007-03-31 17:12:55 +00:00

78 lines
1.7 KiB
PHP

<?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 */
if(!$oUser = create_and_login_user())
{
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);
$oUser->delete();
return $bSuccess;
}
if(!test_url_update())
{
echo "test_url_update() failed!\n";
$bTestSuccess = false;
} else
{
echo "test_url_update() passed\n";
}
?>