From 9faf27262c707368f3ec94af9778b05ed388716c Mon Sep 17 00:00:00 2001 From: n0nag0n Date: Sun, 31 Dec 2023 16:09:16 -0700 Subject: [PATCH] cleaned up some unit test requires --- composer.json | 14 +++++++++++--- phpunit.xml | 1 + tests/AutoloadTest.php | 3 --- tests/DispatcherTest.php | 3 --- tests/FilterTest.php | 3 --- tests/FlightTest.php | 3 --- tests/LoaderTest.php | 1 - tests/MapTest.php | 2 -- tests/RedirectTest.php | 3 --- tests/RegisterTest.php | 2 -- tests/RenderTest.php | 3 --- tests/RequestTest.php | 3 --- tests/RouterTest.php | 3 --- tests/VariableTest.php | 3 --- tests/ViewTest.php | 3 --- tests/phpunit_autoload.php | 6 ++++++ 16 files changed, 18 insertions(+), 38 deletions(-) create mode 100644 tests/phpunit_autoload.php diff --git a/composer.json b/composer.json index 760e656..f5a61d2 100644 --- a/composer.json +++ b/composer.json @@ -43,10 +43,18 @@ } }, "scripts": { - "test": "phpunit tests", + "test": "phpunit", + "test-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage", "lint": "phpstan --no-progress -cphpstan.neon" }, "suggest": { - "phpstan/phpstan": "PHP Static Analysis Tool" - } + "phpstan/phpstan": "PHP Static Analysis Tool", + "latte/latte": "Latte template engine" + }, + "suggest-dev": { + "tracy/tracy": "Tracy debugger" + }, + "replace": { + "mikecao/flight": "2.0.2" + } } diff --git a/phpunit.xml b/phpunit.xml index 76d1463..1577ac2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,5 +1,6 @@ * @license MIT, http://flightphp.com/license */ -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/Flight.php'; - class FlightTest extends PHPUnit\Framework\TestCase { protected function setUp(): void diff --git a/tests/LoaderTest.php b/tests/LoaderTest.php index 2e2de8f..0fa9683 100644 --- a/tests/LoaderTest.php +++ b/tests/LoaderTest.php @@ -8,7 +8,6 @@ use flight\core\Loader; -require_once 'vendor/autoload.php'; require_once __DIR__ . '/classes/User.php'; require_once __DIR__ . '/classes/Factory.php'; diff --git a/tests/MapTest.php b/tests/MapTest.php index 5b0d3df..4f4a0eb 100644 --- a/tests/MapTest.php +++ b/tests/MapTest.php @@ -8,8 +8,6 @@ use flight\Engine; -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; require_once __DIR__ . '/classes/Hello.php'; class MapTest extends PHPUnit\Framework\TestCase diff --git a/tests/RedirectTest.php b/tests/RedirectTest.php index 0f8079a..9099fe4 100644 --- a/tests/RedirectTest.php +++ b/tests/RedirectTest.php @@ -8,9 +8,6 @@ use flight\Engine; -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; - class RedirectTest extends PHPUnit\Framework\TestCase { private Engine $app; diff --git a/tests/RegisterTest.php b/tests/RegisterTest.php index dc383cd..bd67106 100644 --- a/tests/RegisterTest.php +++ b/tests/RegisterTest.php @@ -8,8 +8,6 @@ use flight\Engine; -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; require_once __DIR__ . '/classes/User.php'; class RegisterTest extends PHPUnit\Framework\TestCase diff --git a/tests/RenderTest.php b/tests/RenderTest.php index 260caa6..dccdc69 100644 --- a/tests/RenderTest.php +++ b/tests/RenderTest.php @@ -8,9 +8,6 @@ use flight\Engine; -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/Flight.php'; - class RenderTest extends PHPUnit\Framework\TestCase { private Engine $app; diff --git a/tests/RequestTest.php b/tests/RequestTest.php index 05c8c49..dc7c5cf 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -8,9 +8,6 @@ use flight\net\Request; -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; - class RequestTest extends PHPUnit\Framework\TestCase { private Request $request; diff --git a/tests/RouterTest.php b/tests/RouterTest.php index 5b4069f..db02757 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -10,9 +10,6 @@ use flight\core\Dispatcher; use flight\net\Request; use flight\net\Router; -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; - class RouterTest extends PHPUnit\Framework\TestCase { private Router $router; diff --git a/tests/VariableTest.php b/tests/VariableTest.php index e7a610d..03f2900 100644 --- a/tests/VariableTest.php +++ b/tests/VariableTest.php @@ -5,9 +5,6 @@ * @copyright Copyright (c) 2012, Mike Cao * @license MIT, http://flightphp.com/license */ -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; - class VariableTest extends PHPUnit\Framework\TestCase { /** diff --git a/tests/ViewTest.php b/tests/ViewTest.php index bdfcfeb..485a5bd 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -5,9 +5,6 @@ * @copyright Copyright (c) 2012, Mike Cao * @license MIT, http://flightphp.com/license */ -require_once 'vendor/autoload.php'; -require_once __DIR__ . '/../flight/autoload.php'; - class ViewTest extends PHPUnit\Framework\TestCase { /** diff --git a/tests/phpunit_autoload.php b/tests/phpunit_autoload.php new file mode 100644 index 0000000..7b9b762 --- /dev/null +++ b/tests/phpunit_autoload.php @@ -0,0 +1,6 @@ +