for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Tests;
use App\Application;
use Middlewares\Utils\Factory\ServerRequestFactory;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
abstract class BaseTestCase extends TestCase
{
/**
* @var Application
*/
protected $app;
protected function setUp()
$app = include __DIR__ . '/../bootstrap/app.php';
$this->assertInstanceOf(Application::class, $app);
$this->app = $app;
}
* @param string $method
* @param string $uri
* @return ServerRequestInterface
protected function createRequest($method, $uri)
if (!preg_match('/^http/', $uri)) {
$uri = 'http://localhost/' . ltrim($uri, '/');
$request = (new ServerRequestFactory())->createServerRequest($method, $uri);
$this->assertInstanceOf(ServerRequestInterface::class, $request);
return $request;
* @param ServerRequestInterface $request
* @return ResponseInterface
protected function call(ServerRequestInterface $request)
$response = $this->app->dispatch($request);
$this->assertInstanceOf(ResponseInterface::class, $response);
return $response;