Fix Symfony 3.4 Deprecated PHPUnit Warnings

Consider this simple example:

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
    public function testIndex()
    {
        $client = static::createClient();

        $client->request('GET', '/');

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
    }
}

When doing this through PHPUnit, I get the following warning

Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "test.client.history" service to "Symfony\Component\BrowserKit\History" instead: 1x
    1x in KitaControllerTest::testIndex from Tests\AppBundle\Controller

How can I fix this warning since it is declared in the Symfony kernel.

I am running Symfony 3.4.3

+4
source share

Source: https://habr.com/ru/post/1692227/


All Articles