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__);
global $test_email, $test_password;
$bSuccess = true; // default to success until we detect failure
/* Log in */
2007-01-27 22:58:58 +00:00
if(!$oUser = create_and_login_user())
2007-01-19 01:41:01 +00:00
{
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);
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
?>