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

78 lines
1.7 KiB
PHP
Raw Normal View History

2007-01-19 01:41:01 +00:00
<?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__);
$bSuccess = true; // default to success until we detect failure
/* Log in */
$sTestUser = __FUNCTION__."@localhost.com";
$sTestPassword = "password";
if(!$oUser = create_and_login_user($sTestUser, $sTestPassword))
2007-01-19 01:41:01 +00:00
{
error("Received '$retval' instead of SUCCESS('".SUCCESS."').");
2007-01-19 01:41:01 +00:00
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)
{
error("Description is '$oUrl->sDescription' instead of '$sDescriptionNew'");
2007-01-19 01:41:01 +00:00
$bSuccess = false;
}
if($oUrl->sUrl != $sUrlNew)
{
error("Url is '$oUrl->sUrl' instead of '$sUrlNew'");
2007-01-19 01:41:01 +00:00
$bSuccess = false;
}
if($oUrl->iVersionId != $iVersionIdNew)
{
error("VersionId is '$oUrl->iVersionId' instead of '$iVersionIdNew'");
2007-01-19 01:41:01 +00:00
$bSuccess = false;
}
if($oUrl->iAppId != $iAppIdNew)
{
error("AppId is '$oUrl->iAppId' instead of '$iAppIdNew'");
2007-01-19 01:41:01 +00:00
$bSuccess = false;
}
$oUrl->delete(TRUE);
2007-01-27 22:58:58 +00:00
$oUser->delete();
2007-01-19 01:41:01 +00:00
return $bSuccess;
}
if(!test_url_update())
{
2007-01-19 01:41:01 +00:00
echo "test_url_update() failed!\n";
$bTestSuccess = false;
} else
{
2007-01-19 01:41:01 +00:00
echo "test_url_update() passed\n";
}
2007-01-19 01:41:01 +00:00
?>