added phpunit config for testing coverage

pull/499/head
Austin Collier 1 year ago
parent 2df64f37ea
commit 3d58a5bee4

3
.gitignore vendored

@ -2,3 +2,6 @@
vendor/
composer.phar
composer.lock
.phpunit.result.cache
coverage/
.vscode/settings.json

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
executionOrder="random"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
stopOnError="true"
stopOnFailure="true"
verbose="true"
colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">flight/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="default">
<directory>tests/</directory>
</testsuite>
</testsuites>
<logging/>
</phpunit>

@ -18,9 +18,16 @@ class FlightTest extends PHPUnit\Framework\TestCase
{
protected function setUp(): void
{
$_SERVER = [];
$_REQUEST = [];
Flight::init();
}
protected function tearDown(): void {
unset($_REQUEST);
unset($_SERVER);
}
// Checks that default components are loaded
public function testDefaultComponents()
{

@ -17,6 +17,8 @@ class RequestTest extends PHPUnit\Framework\TestCase
protected function setUp(): void
{
$_SERVER = [];
$_REQUEST = [];
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['REQUEST_METHOD'] = 'GET';
@ -34,6 +36,11 @@ class RequestTest extends PHPUnit\Framework\TestCase
$this->request = new Request();
}
protected function tearDown(): void {
unset($_REQUEST);
unset($_SERVER);
}
public function testDefaults()
{
self::assertEquals('/', $this->request->url);

@ -23,11 +23,18 @@ class RouterTest extends PHPUnit\Framework\TestCase
protected function setUp(): void
{
$_SERVER = [];
$_REQUEST = [];
$this->router = new Router();
$this->request = new Request();
$this->dispatcher = new Dispatcher();
}
protected function tearDown(): void {
unset($_REQUEST);
unset($_SERVER);
}
// Simple output
public function ok()
{

Loading…
Cancel
Save