From a59829d8fdbcf4efb1d9b9608c743bf5ed460306 Mon Sep 17 00:00:00 2001 From: Arshid Date: Thu, 1 Jan 2026 13:04:11 +0530 Subject: [PATCH] Add return type - tests --- tests/EngineTest.php | 24 ++++++++++++------------ tests/RouterTest.php | 4 ++-- tests/UploadedFileTest.php | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/EngineTest.php b/tests/EngineTest.php index 91e9f3b..bdb5302 100644 --- a/tests/EngineTest.php +++ b/tests/EngineTest.php @@ -52,7 +52,7 @@ class EngineTest extends TestCase public function testInitBeforeStartV2OutputBuffering(): void { $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -122,7 +122,7 @@ class EngineTest extends TestCase $_SERVER['REQUEST_URI'] = '/someRoute'; $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -141,7 +141,7 @@ class EngineTest extends TestCase $_SERVER['REQUEST_URI'] = '/someRoute'; $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -160,7 +160,7 @@ class EngineTest extends TestCase $_SERVER['REQUEST_URI'] = '/someRoute'; $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -180,7 +180,7 @@ class EngineTest extends TestCase $_SERVER['REQUEST_URI'] = '/someRoute'; $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -207,7 +207,7 @@ class EngineTest extends TestCase $_SERVER['REQUEST_URI'] = '/someRoute'; $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -254,7 +254,7 @@ class EngineTest extends TestCase $_SERVER['REQUEST_URI'] = '/someRoute'; $engine = new class extends Engine { - public function getInitializedVar() + public function getInitializedVar(): bool { return $this->initialized; } @@ -276,7 +276,7 @@ class EngineTest extends TestCase $engine->start(); } - public function testDoubleStart() + public function testDoubleStart(): void { $engine = new Engine(); $engine->route('/someRoute', function () { @@ -512,7 +512,7 @@ class EngineTest extends TestCase $this->assertEquals('{"key1":"value1","key2":"value2","utf8_emoji":"😀"}', $engine->response()->getBody()); } - public function testJsonThrowOnErrorByDefault() + public function testJsonThrowOnErrorByDefault(): void { $engine = new Engine(); $this->expectException(Exception::class); @@ -1000,7 +1000,7 @@ class EngineTest extends TestCase $engine->start(); } - public function testContainerPsr11() { + public function testContainerPsr11(): void { $engine = new Engine(); $container = new \League\Container\Container(); $container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class); @@ -1031,7 +1031,7 @@ class EngineTest extends TestCase $engine->start(); } - public function testContainerPsr11MethodNotFound() { + public function testContainerPsr11MethodNotFound(): void { $engine = new Engine(); $container = new \League\Container\Container(); $container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class); @@ -1048,7 +1048,7 @@ class EngineTest extends TestCase $engine->start(); } - public function testRouteFoundButBadMethod() { + public function testRouteFoundButBadMethod(): void { $engine = new class extends Engine { public function getLoader() { diff --git a/tests/RouterTest.php b/tests/RouterTest.php index c0ed3c1..620ecc3 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -39,7 +39,7 @@ class RouterTest extends TestCase } // 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); @@ -502,7 +502,7 @@ class RouterTest extends TestCase { $router = new class extends Router { - public function getIndex() + public function getIndex(): int { return $this->index; } diff --git a/tests/UploadedFileTest.php b/tests/UploadedFileTest.php index 9a531f5..f8817f3 100644 --- a/tests/UploadedFileTest.php +++ b/tests/UploadedFileTest.php @@ -55,7 +55,7 @@ class UploadedFileTest extends TestCase /** * @dataProvider getFileErrorMessageTests */ - public function testMoveToFailureMessages($error, $message) + public function testMoveToFailureMessages(int $error, string $message): void { file_put_contents('tmp_name', 'test'); $uploadedFile = new UploadedFile('file.txt', 'text/plain', 4, 'tmp_name', $error);