Merge pull request #676 from arshidkv12/return-type-tests

Return type - tests
master
n0nag0n 2 days ago committed by GitHub
commit 2ab26aa326
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -33,7 +33,7 @@ class AiGenerateInstructionsCommand extends AbstractBaseCommand
* *
* @return int * @return int
*/ */
public function execute() public function execute(): int
{ {
$io = $this->app()->io(); $io = $this->app()->io();

@ -27,7 +27,7 @@ class AiInitCommand extends AbstractBaseCommand
* *
* @return int * @return int
*/ */
public function execute() public function execute(): int
{ {
$io = $this->app()->io(); $io = $this->app()->io();

@ -26,7 +26,7 @@ class ControllerCommand extends AbstractBaseCommand
* *
* @return void * @return void
*/ */
public function execute(string $controller) public function execute(string $controller): void
{ {
$io = $this->app()->io(); $io = $this->app()->io();

@ -37,7 +37,7 @@ class RouteCommand extends AbstractBaseCommand
* *
* @return void * @return void
*/ */
public function execute() public function execute(): void
{ {
$io = $this->app()->io(); $io = $this->app()->io();

@ -375,7 +375,7 @@ class Request
* *
* @return string * @return string
*/ */
public static function header(string $header, $default = '') public static function header(string $header, $default = ''): string
{ {
return self::getHeader($header, $default); return self::getHeader($header, $default);
} }

@ -52,7 +52,7 @@ class EngineTest extends TestCase
public function testInitBeforeStartV2OutputBuffering(): void public function testInitBeforeStartV2OutputBuffering(): void
{ {
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -122,7 +122,7 @@ class EngineTest extends TestCase
$_SERVER['REQUEST_URI'] = '/someRoute'; $_SERVER['REQUEST_URI'] = '/someRoute';
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -141,7 +141,7 @@ class EngineTest extends TestCase
$_SERVER['REQUEST_URI'] = '/someRoute'; $_SERVER['REQUEST_URI'] = '/someRoute';
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -160,7 +160,7 @@ class EngineTest extends TestCase
$_SERVER['REQUEST_URI'] = '/someRoute'; $_SERVER['REQUEST_URI'] = '/someRoute';
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -180,7 +180,7 @@ class EngineTest extends TestCase
$_SERVER['REQUEST_URI'] = '/someRoute'; $_SERVER['REQUEST_URI'] = '/someRoute';
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -207,7 +207,7 @@ class EngineTest extends TestCase
$_SERVER['REQUEST_URI'] = '/someRoute'; $_SERVER['REQUEST_URI'] = '/someRoute';
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -254,7 +254,7 @@ class EngineTest extends TestCase
$_SERVER['REQUEST_URI'] = '/someRoute'; $_SERVER['REQUEST_URI'] = '/someRoute';
$engine = new class extends Engine { $engine = new class extends Engine {
public function getInitializedVar() public function getInitializedVar(): bool
{ {
return $this->initialized; return $this->initialized;
} }
@ -276,7 +276,7 @@ class EngineTest extends TestCase
$engine->start(); $engine->start();
} }
public function testDoubleStart() public function testDoubleStart(): void
{ {
$engine = new Engine(); $engine = new Engine();
$engine->route('/someRoute', function () { $engine->route('/someRoute', function () {
@ -512,7 +512,7 @@ class EngineTest extends TestCase
$this->assertEquals('{"key1":"value1","key2":"value2","utf8_emoji":"😀"}', $engine->response()->getBody()); $this->assertEquals('{"key1":"value1","key2":"value2","utf8_emoji":"😀"}', $engine->response()->getBody());
} }
public function testJsonThrowOnErrorByDefault() public function testJsonThrowOnErrorByDefault(): void
{ {
$engine = new Engine(); $engine = new Engine();
$this->expectException(Exception::class); $this->expectException(Exception::class);
@ -1000,7 +1000,7 @@ class EngineTest extends TestCase
$engine->start(); $engine->start();
} }
public function testContainerPsr11() { public function testContainerPsr11(): void {
$engine = new Engine(); $engine = new Engine();
$container = new \League\Container\Container(); $container = new \League\Container\Container();
$container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class); $container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class);
@ -1031,7 +1031,7 @@ class EngineTest extends TestCase
$engine->start(); $engine->start();
} }
public function testContainerPsr11MethodNotFound() { public function testContainerPsr11MethodNotFound(): void {
$engine = new Engine(); $engine = new Engine();
$container = new \League\Container\Container(); $container = new \League\Container\Container();
$container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class); $container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class);
@ -1048,7 +1048,7 @@ class EngineTest extends TestCase
$engine->start(); $engine->start();
} }
public function testRouteFoundButBadMethod() { public function testRouteFoundButBadMethod(): void {
$engine = new class extends Engine { $engine = new class extends Engine {
public function getLoader() public function getLoader()
{ {

@ -39,7 +39,7 @@ class RouterTest extends TestCase
} }
// Checks if a route was matched with a given output // Checks if a route was matched with a given output
public function check($str = '') public function check($str = ''): void
{ {
/*$route = $this->router->route($this->request); /*$route = $this->router->route($this->request);
@ -502,7 +502,7 @@ class RouterTest extends TestCase
{ {
$router = new class extends Router $router = new class extends Router
{ {
public function getIndex() public function getIndex(): int
{ {
return $this->index; return $this->index;
} }

@ -55,7 +55,7 @@ class UploadedFileTest extends TestCase
/** /**
* @dataProvider getFileErrorMessageTests * @dataProvider getFileErrorMessageTests
*/ */
public function testMoveToFailureMessages($error, $message) public function testMoveToFailureMessages(int $error, string $message): void
{ {
file_put_contents('tmp_name', 'test'); file_put_contents('tmp_name', 'test');
$uploadedFile = new UploadedFile('file.txt', 'text/plain', 4, 'tmp_name', $error); $uploadedFile = new UploadedFile('file.txt', 'text/plain', 4, 'tmp_name', $error);

Loading…
Cancel
Save