Added support for PHP7

This commit is contained in:
Simon Sessingø
2018-03-20 03:38:55 +01:00
parent d279d5598d
commit f23d569757
58 changed files with 678 additions and 532 deletions

41
tests/TestRouter.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
class TestRouter extends \Pecee\SimpleRouter\SimpleRouter
{
public static function debugNoReset($testUrl, $testMethod = 'get')
{
static::request()->setUrl($testUrl);
static::request()->setMethod($testMethod);
static::start();
}
public static function debug($testUrl, $testMethod = 'get')
{
try {
static::debugNoReset($testUrl, $testMethod);
} catch(\Exception $e) {
static::router()->reset();
throw $e;
}
static::router()->reset();
}
public static function debugOutput($testUrl, $testMethod = 'get')
{
$response = null;
// Route request
ob_start();
static::debug($testUrl, $testMethod);
$response = ob_get_contents();
ob_end_clean();
// Return response
return $response;
}
}