[3.x-dev] Symfony 5.0 Form must be an instance of Client instead of KernelBrowser
Voetloos opened this issue · comments
I upgrade my project to Symfony 5.0. Since this bundle is not yet updated I used the dev version. 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.
I looked into this and found in QueryCountClient.php
the following:
if (!class_exists(Client::class)) {
class_alias(KernelBrowser::class, Client::class);
}
I suspect this is either not working or missing in some other place.
I still had Client
somewhere in my code, so it expected a client.
Feel free to add the required changes in the bundle documentation, it could be a new section about Symfony 5, it could fit in the https://github.com/liip/LiipFunctionalTestBundle/blob/master/CHANGELOG.md