猜测内核目录时发生PhpUnit错误

猜测内核目录时发生PhpUnit错误,php,phpunit,kernel,Php,Phpunit,Kernel,这是我的PhpUnit测试类: <?php namespace tests\AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class SendEmailControllerTest extends WebTestCase { public function testMailIsSentAndContentIsCorrect() { $client =

这是我的PhpUnit测试类:

<?php

namespace tests\AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class SendEmailControllerTest extends WebTestCase
{
    public function testMailIsSentAndContentIsCorrect()
    {
        $client = static:: createClient();

        ...
    }
}
但问题是我不明白如何修复跟踪中指出的弃用问题

编辑:

在官方文档之后,我在phpunit.xml.dist中添加了

<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
         backupGlobals="false"
         colors="true"
         bootstrap="vendor/autoload.php"
>
    <php>
        <ini name="error_reporting" value="-1" />
        <env name="KERNEL_CLASS" value="App\Kernel" />
        <server name="KERNEL_CLASS" value="AppKernel" />
    </php>

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>src</directory>
            <exclude>
                <directory>src/*Bundle/Resources</directory>
                <directory>src/*/*Bundle/Resources</directory>
                <directory>src/*/Bundle/*Bundle/Resources</directory>
            </exclude>
        </whitelist>
    </filter>
</phpunit>

测验
src
src/*Bundle/Resources
src/*/*捆绑包/资源
src/*/Bundle/*Bundle/Resources
然而:

1) 我仍然会犯同样的错误

2) 代码
http://schema.phpunit.de/4.8/phpunit.xsd
以红色显示,并显示消息“URI未注册(设置|语言与框架|架构和DTD)。因此,我在“外部架构和DTD”中访问了该位置“我添加了这个URI,位置是我的项目根目录。但是,此红色警告仍然存在,我怀疑它与位置有关,但是它在哪里?

要运行功能测试,WebTestCase类需要知道 这是引导它的应用程序内核。内核类是 通常在
KERNEL\u类中定义
环境变量(包括 在Symfony提供的默认phpunit.xml.dist文件中):



phpunit.xml.dist中设置此选项,使其在symfony 3.4中适用

<php>
    <!-- the value is the FQCN of the application kernel -->
    <env name="KERNEL_CLASS" value="AppKernel" />
</php>

Nikita U.在这里是正确的,但我想指出一些小事情,它们可能会在未来帮助其他人,特别是在地理位置上


根据我发现的许多注释,特别是回购协议中的注释,这应该是
,我可以确认这清除了Symfony 3.4.17中
内核测试用例周围的弃用消息。
<?xml version="1.0" charset="utf-8" ?>
<phpunit>
    <php>
        <!-- the value is the FQCN of the application kernel -->
        <env name="KERNEL_CLASS" value="App\Kernel" />
    </php>
    <!-- ... -->
</phpunit>
<php>
    <!-- the value is the FQCN of the application kernel -->
    <env name="KERNEL_CLASS" value="AppKernel" />
</php>