add invalid api function tests

This commit is contained in:
Dennis Eichhorn 2023-10-18 01:03:57 +00:00
parent 333158e933
commit 92dabf580e

View File

@ -25,15 +25,15 @@ function createFunction($name)
{ {
$invalid = <<<HEREDOC $invalid = <<<HEREDOC
public function testInvalid{$name}() : void public function testInvalid{$name}() : void
{ {
\$response = new HttpResponse(); \$response = new HttpResponse();
\$request = new HttpRequest(new HttpUri('')); \$request = new HttpRequest(new HttpUri(''));
\$request->header->account = 1; \$request->header->account = 1;
\$this->module->{$name}(\$request, \$response); \$this->module->{$name}(\$request, \$response);
self::assertEquals(RequestStatusCode::R_400, \$response->header->status); self::assertEquals(RequestStatusCode::R_400, \$response->header->status);
} }
HEREDOC; HEREDOC;
@ -136,7 +136,7 @@ foreach ($modules as $module) {
echo $function . "\n"; echo $function . "\n";
$newContent = \createFunction($function); $newContent = \createFunction($function);
$newContent = \rtrim($testFile, " }\n") . "\n }\n" . $newContent . "}\n"; $newContent = \rtrim($testFile, " }\n") . "\n }\n" . $newContent . "}\n";
//\file_put_contents($path, $newContent); \file_put_contents($path, $newContent);
$open[$function] = 1; $open[$function] = 1;
} }
} }
@ -152,7 +152,7 @@ foreach ($modules as $module) {
echo $function . "\n"; echo $function . "\n";
$newContent = \createFunction($function); $newContent = \createFunction($function);
$newContent = \rtrim($testFile, " }\n") . "\n }\n" . $newContent . "}\n"; $newContent = \rtrim($testFile, " }\n") . "\n }\n" . $newContent . "}\n";
//\file_put_contents($path, $newContent); \file_put_contents($path, $newContent);
$open[$function] = 1; $open[$function] = 1;
} }
} }