symfony5liipfunctionaltestbundle

Symfony 5.0 LiipFunctionalTestBundle Form must be an instance of Client instead of KernelBrowser


I upgrade my project to Symfony 5.0. However, when running tests I get the following error:

TypeError: Argument 1 passed to App\Tests\PagesTestCase::form() must be an instance of Symfony\Bundle\FrameworkBundle\Client, instance of Symfony\Bundle\FrameworkBundle\KernelBrowser given

Argument 1 in this form is $userClient, which is created with createClient. In Symfony 5, Symfony\Bundle\FrameworkBundle\Client is removed. Why is it still expecting an instance of Client? I am using LiipFunctionalTestBundle

I looked into the src of LiipFunctionalTestBundle and found in QueryCountClient.php the following:

if (!class_exists(Client::class)) {
    class_alias(KernelBrowser::class, Client::class);
}

It seems to me that this should fix the issue, however, it does not. I am clueless about why I am getting this error.


Solution

  • I still had Client somewhere in my code, so it expected a client.