我将项目升级到Symfony 5.0。但是,在运行测试时,出现以下错误:
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
此格式的参数1是$userClient
,它是用createClient
创建的。在Symfony 5中,Symfony\Bundle\FrameworkBundle\Client
被删除。为什么还期望有Client实例?我正在使用LiipFunctionalTestBundle
我查看了LiipFunctionalTestBundle
的src,并在QueryCountClient.php
中发现以下内容:
if (!class_exists(Client::class)) {
class_alias(KernelBrowser::class, Client::class);
}
在我看来,这应该可以解决问题,但事实并非如此。我不知道为什么会收到此错误。