修复Symfony 3.4不推荐的警告PHPUnit

修复Symfony 3.4不推荐的警告PHPUnit,php,symfony,phpunit,deprecated,Php,Symfony,Phpunit,Deprecated,考虑这个简单的例子: use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DefaultControllerTest extends WebTestCase { public function testIndex() { $client = static::createClient(); $client->request('GET', '/'); $thi

考虑这个简单的例子:

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());
    }
}
当通过PHPUnit执行此操作时,我得到以下警告

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
由于这是在Symfony的核心中声明的,如何修复此警告


我正在运行Symfony 3.4.3

排除your services.yaml中的测试目录。Autowire正在尝试连接您的测试控制器。@Cerad autowiring仅用于
src/
dir-no
tests/
Insights您似乎已在一些
services.yml
中注册了
test.client.history
服务。也许?@MarçalBerga AFAIK此服务是在Symfony的核心中定义的,而不是在我的应用程序逻辑中。请显示控制器的内容