diff --git a/tests/AutoloadTest.php b/tests/AutoloadTest.php index ff44485..cb35757 100644 --- a/tests/AutoloadTest.php +++ b/tests/AutoloadTest.php @@ -1,20 +1,13 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; +use PHPUnit\Framework\TestCase; -class AutoloadTest extends PHPUnit\Framework\TestCase +class AutoloadTest extends TestCase { - /** - * @var Engine - */ - private $app; + private Engine $app; protected function setUp(): void { diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index 8be746b..124fba2 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -1,21 +1,17 @@ - * @license MIT, http://flightphp.com/license - */ -class CollectionTest extends PHPUnit\Framework\TestCase +declare(strict_types=1); + +use flight\util\Collection; +use PHPUnit\Framework\TestCase; + +class CollectionTest extends TestCase { - /** - * @var \flight\util\Collection - */ - private $collection; + private Collection $collection; protected function setUp(): void { - $this->collection = new \flight\util\Collection(['a' => 1, 'b' => 2]); + $this->collection = new Collection(['a' => 1, 'b' => 2]); } // Get an item diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index cb8edf9..1e10c26 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -1,19 +1,12 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\core\Dispatcher; +use PHPUnit\Framework\TestCase; -class DispatcherTest extends PHPUnit\Framework\TestCase +class DispatcherTest extends TestCase { - /** - * @var Dispatcher|null - */ private Dispatcher $dispatcher; protected function setUp(): void @@ -131,7 +124,7 @@ class DispatcherTest extends PHPUnit\Framework\TestCase return "Hello, $name!"; }); - $this->dispatcher->hook('hello', 'before', function (&$params, &$output) { + $this->dispatcher->hook('hello', 'before', function (&$params) { // Manipulate the parameter $params[0] = 'Fred'; }); diff --git a/tests/EngineTest.php b/tests/EngineTest.php index 833cbbe..c4cb109 100644 --- a/tests/EngineTest.php +++ b/tests/EngineTest.php @@ -1,11 +1,6 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; use flight\net\Response; @@ -263,7 +258,7 @@ class EngineTest extends TestCase $this->assertEquals(200, $engine->response()->status()); } - public function testJsonPBadParam() + public function testJsonpBadParam() { $engine = new Engine(); $engine->jsonp(['key1' => 'value1', 'key2' => 'value2']); diff --git a/tests/FilterTest.php b/tests/FilterTest.php index fbf27e0..4798045 100644 --- a/tests/FilterTest.php +++ b/tests/FilterTest.php @@ -1,20 +1,13 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; +use PHPUnit\Framework\TestCase; -class FilterTest extends PHPUnit\Framework\TestCase +class FilterTest extends TestCase { - /** - * @var Engine - */ - private $app; + private Engine $app; protected function setUp(): void { @@ -28,7 +21,7 @@ class FilterTest extends PHPUnit\Framework\TestCase return "Hello, $name!"; }); - $this->app->before('hello', function (&$params, &$output) { + $this->app->before('hello', function (&$params) { // Manipulate the parameter $params[0] = 'Fred'; }); @@ -50,15 +43,15 @@ class FilterTest extends PHPUnit\Framework\TestCase return "Bye, $name!"; }); - $this->app->before('bye', function (&$params, &$output) { + $this->app->before('bye', function (&$params) { $params[0] = 'Bob'; }); - $this->app->before('bye', function (&$params, &$output) { + $this->app->before('bye', function (&$params) { $params[0] = 'Fred'; return false; }); - $this->app->before('bye', function (&$params, &$output) { + $this->app->before('bye', function (&$params) { $params[0] = 'Ted'; }); diff --git a/tests/FlightTest.php b/tests/FlightTest.php index 07a7346..90bed34 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -1,18 +1,15 @@ - * @license MIT, http://flightphp.com/license - */ -class FlightTest extends PHPUnit\Framework\TestCase +class FlightTest extends TestCase { protected function setUp(): void { @@ -79,11 +76,11 @@ class FlightTest extends PHPUnit\Framework\TestCase self::assertIsObject($user); self::assertInstanceOf(User::class, $user); - Flight::unregister('user'); + Flight::unregister('user'); - self::expectException(Exception::class); - self::expectExceptionMessage('user must be a mapped method.'); - $user = Flight::user(); + self::expectException(Exception::class); + self::expectExceptionMessage('user must be a mapped method.'); + $user = Flight::user(); } // Map a function diff --git a/tests/LoaderTest.php b/tests/LoaderTest.php index 2ed2be9..e7240b4 100644 --- a/tests/LoaderTest.php +++ b/tests/LoaderTest.php @@ -1,11 +1,6 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\core\Loader; use PHPUnit\Framework\TestCase; diff --git a/tests/MapTest.php b/tests/MapTest.php index dc75b56..1e67c49 100644 --- a/tests/MapTest.php +++ b/tests/MapTest.php @@ -1,11 +1,6 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; use PHPUnit\Framework\TestCase; diff --git a/tests/PdoWrapperTest.php b/tests/PdoWrapperTest.php index 32c3c99..3543140 100644 --- a/tests/PdoWrapperTest.php +++ b/tests/PdoWrapperTest.php @@ -1,22 +1,13 @@ - * @license MIT, http://flightphp.com/license - */ - +declare(strict_types=1); +use flight\database\PdoWrapper; +use PHPUnit\Framework\TestCase; -class PdoWrapperTest extends PHPUnit\Framework\TestCase +class PdoWrapperTest extends TestCase { - /** - * @var Pdo_Wrapper - */ - private $pdo_wrapper; + private PdoWrapper $pdo_wrapper; protected function setUp(): void { diff --git a/tests/RedirectTest.php b/tests/RedirectTest.php index 758df92..2888b0d 100644 --- a/tests/RedirectTest.php +++ b/tests/RedirectTest.php @@ -1,15 +1,11 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; +use PHPUnit\Framework\TestCase; -class RedirectTest extends PHPUnit\Framework\TestCase +class RedirectTest extends TestCase { private Engine $app; diff --git a/tests/RegisterTest.php b/tests/RegisterTest.php index 370b1ab..7c51cb0 100644 --- a/tests/RegisterTest.php +++ b/tests/RegisterTest.php @@ -1,11 +1,6 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; use PHPUnit\Framework\TestCase; diff --git a/tests/RenderTest.php b/tests/RenderTest.php index c49bf53..c030b78 100644 --- a/tests/RenderTest.php +++ b/tests/RenderTest.php @@ -1,15 +1,11 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\Engine; +use PHPUnit\Framework\TestCase; -class RenderTest extends PHPUnit\Framework\TestCase +class RenderTest extends TestCase { private Engine $app; diff --git a/tests/RequestTest.php b/tests/RequestTest.php index 7d31cf2..c11549e 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -1,16 +1,12 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\net\Request; use flight\util\Collection; +use PHPUnit\Framework\TestCase; -class RequestTest extends PHPUnit\Framework\TestCase +class RequestTest extends TestCase { private Request $request; diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index 6d6f129..6b106eb 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -1,17 +1,13 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\net\Request; use flight\net\Response; use flight\util\Collection; +use PHPUnit\Framework\TestCase; -class ResponseTest extends PHPUnit\Framework\TestCase +class ResponseTest extends TestCase { protected function setUp(): void { @@ -177,7 +173,7 @@ class ResponseTest extends PHPUnit\Framework\TestCase 'max-age=0', ] ]; - public function setRealHeader(string $header_string, bool $replace = true, int $response_code = 0): Response + public function setRealHeader(string $header_string, bool $replace = true, int $response_code = 0): self { $this->test_sent_headers[] = $header_string; return $this; @@ -216,7 +212,7 @@ class ResponseTest extends PHPUnit\Framework\TestCase $response = new class extends Response { protected $test_sent_headers = []; - public function setRealHeader(string $header_string, bool $replace = true, int $response_code = 0): Response + public function setRealHeader(string $header_string, bool $replace = true, int $response_code = 0): self { $this->test_sent_headers[] = $header_string; return $this; diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 12f1543..b8f7453 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -1,17 +1,13 @@ - * @license MIT, http://flightphp.com/license - */ +declare(strict_types=1); use flight\core\Dispatcher; use flight\net\Request; use flight\net\Router; +use PHPUnit\Framework\TestCase; -class RouterTest extends PHPUnit\Framework\TestCase +class RouterTest extends TestCase { private Router $router; @@ -43,15 +39,14 @@ class RouterTest extends PHPUnit\Framework\TestCase // Checks if a route was matched with a given output public function check($str = '') { - /* - $route = $this->router->route($this->request); + + /*$route = $this->router->route($this->request); $params = array_values($route->params); $this->assertTrue(is_callable($route->callback)); - call_user_func_array($route->callback, $params); - */ + call_user_func_array($route->callback, $params);*/ $this->routeRequest(); $this->expectOutputString($str); diff --git a/tests/VariableTest.php b/tests/VariableTest.php index 8bc7462..cf46afe 100644 --- a/tests/VariableTest.php +++ b/tests/VariableTest.php @@ -1,21 +1,17 @@ - * @license MIT, http://flightphp.com/license - */ -class VariableTest extends PHPUnit\Framework\TestCase +declare(strict_types=1); + +use flight\Engine; +use PHPUnit\Framework\TestCase; + +class VariableTest extends TestCase { - /** - * @var \flight\Engine - */ - private $app; + private Engine $app; protected function setUp(): void { - $this->app = new \flight\Engine(); + $this->app = new Engine(); } // Set and get a variable diff --git a/tests/ViewTest.php b/tests/ViewTest.php index 7bd1dd4..db25c26 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -1,5 +1,7 @@ assertEquals('<script>', $result); } - public function testENoNeedToEscape() + public function testeNoNeedToEscape() { $this->expectOutputString('script'); $result = $this->view->e('script'); diff --git a/tests/phpunit_autoload.php b/tests/phpunit_autoload.php index 1114632..5bf47da 100644 --- a/tests/phpunit_autoload.php +++ b/tests/phpunit_autoload.php @@ -1,6 +1,9 @@