Fix namespace
Improved testing methods
This commit is contained in:
parent
afda056ba9
commit
d042a3b84a
3 changed files with 27 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use App\Exception\Handlers\AppErrorHandler;
|
||||
use App\Exception\Handlers\Renderers\HtmlErrorRenderer;
|
||||
use App\Exceptions\Handlers\AppErrorHandler;
|
||||
use App\Exceptions\Handlers\Renderers\HtmlErrorRenderer;
|
||||
use App\Factories\ViewFactory;
|
||||
use App\Middleware\InjectMiddleware;
|
||||
use App\Middleware\LangMiddleware;
|
||||
|
|
|
@ -11,7 +11,7 @@ class LoginControllerTest extends TestCase
|
|||
/** @test */
|
||||
public function it_loads_the_login_page()
|
||||
{
|
||||
$this->client->request('GET', '/login');
|
||||
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
|
||||
$response = $this->get('/login');
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests;
|
||||
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
|
@ -16,4 +17,26 @@ abstract class TestCase extends BaseTestCase
|
|||
|
||||
$this->client = new Client();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $uri
|
||||
* @param array $parameters
|
||||
* @return Response|object
|
||||
*/
|
||||
public function get(string $uri, array $parameters = [])
|
||||
{
|
||||
$this->client->request('GET', $uri, $parameters);
|
||||
return $this->client->getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $uri
|
||||
* @param array $parameters
|
||||
* @return Response|object
|
||||
*/
|
||||
public function post(string $uri, array $parameters = [])
|
||||
{
|
||||
$this->client->request('POST', $uri, $parameters);
|
||||
return $this->client->getResponse();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue