I am trying to execute my first unit test with PHPUnit 9.0.0 and Symfony 5.1.8. This test must to pass if the HTTP response is 200.
<?php declare(strict_types=1);
namespace Tests\Infrastructure\Api\Controller;
use PHPUnit\Framework\TestCase;
class ControllerTests extends TestCase
{
/** @test */
public function route(): void
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
I obtain the error:
There was 1 error:
- Tests\Infrastructure\Api\Controller\SupplierControllerTests::route Error: Call to undefined method Tests\Infrastructure\Api\Controller\SupplierControllerTests::get()
I thought the Get method was a default method, imported by PHPUnit\Framework\TestCase, but it do not look that.
Have I to add a Get method into my class ControllerTests? How can i develop it to test the HTTP response?
Thanks in advance