1
0

and more selftest fixes... ... ... ... ...

This commit is contained in:
Mike Schwörer 2020-01-20 18:58:26 +01:00
parent ef2c76c483
commit e529b2dca3
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 12 additions and 5 deletions

View File

@ -133,8 +133,8 @@ class SelfTest implements IWebsiteModule
$this->addMethodPathStatus( "api::default::aoc-ajax-5", 200, "/api/html::panel_aoc_calendar?year=2019&nav=true&linkheader=false&ajax=true&frameid=x");
$this->addMethodPathStatus( "api::default::aoc-ajax-6", 200, "/api/html::panel_aoc_calendar?year=2019&nav=true&linkheader=true&ajax=false&frameid=x");
$this->addMethodPathStatus( "api::default::aoc-ajax-7", 200, "/api/html::panel_aoc_calendar?year=2019&nav=false&linkheader=false&ajax=false&frameid=x");
$this->addMethodPathStatus( "api::default::404-1", 404, '/api/update/no_prog_xx');
$this->addMethodPathStatus( "api::default::404-2", 404, '/api/asdf::notfound');
$this->addMethodPathStatus( "api::default::api-404-1", 404, '/api/update/no_prog_xx');
$this->addMethodPathStatus( "api::default::api-404-2", 404, '/api/asdf::notfound');
$this->addMethodPathStatus( "api::highscore::listgames-1", 200, "/highscores/list.php");
$this->addMethodPathStatus( "api::highscore::listgames-2", 200, "/highscores/list");
@ -593,13 +593,15 @@ class SelfTest implements IWebsiteModule
'exception' => null,
];
}
if ($r['redirect'] !== $url2)
if (rtrim($r['redirect'], "/\t \n#") !== rtrim($url2, "/\t \n#"))
{
return
[
'result' => self::STATUS_ERROR,
'message' => '{'.$xname.'} failed: Request returned wrong redirect',
'long' => 'Wrong Redirect URL (Expected: ['.$url2.']; Found: ['.$r['redirect'].'])' . "\n" .
'long' => "Wrong Redirect URL\n" .
'Expected: "'.$url2.'"' . "\n" .
'Found: "'.$r['redirect'].'")' . "\n" .
"Response:\n" . $r['output'] . "\n" .
"Redirect:\n" . $r['redirect'] . "\n".
"Error [" . $r['errnum'] . "]:\n" . $r['errstr'],

View File

@ -41,6 +41,8 @@ $cmd = strtolower($ROUTE->parameter['cmd']);
if (!array_key_exists($cmd, $API_COMMANDS))
{
ob_clean();
print("<div style=\"white-space: pre;font-family: monospace;\">\n");
print(" \n");
print(" \n");
print(" ... \n");
@ -66,8 +68,11 @@ if (!array_key_exists($cmd, $API_COMMANDS))
print(" ::::::`:::::;' / / `# \n");
print(" \n");
print(" \n");
print("</div>\n");
print("Wrong command.");
$reaper = ob_get_clean();
$FRAME_OPTIONS->forceResult(400, 'Wrong command.');
$FRAME_OPTIONS->forceResult(404, $reaper);
return;
}