如何在要求我在 phpunit.xml 中设置 KERNEL_DIR 的 PHPUnit 中解决此问题?

How to resolve this in PHPUnit where it is asking me to set KERNEL_DIR in my phpunit.xml?

这是我的 phpunit.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
        colors="true"
        convertErrorsToExceptions="true"
        convertNoticesToExceptions="true"
        convertWarningsToExceptions="true"
        stopOnFailure="true"
        strict="true"
        bootstrap="./vendor/autoload.php">
    <testsuites>
        <php>
            <server name="KERNEL_DIR" value="app" />
            <ini name="display_errors" value="true"/>
        </php>
        <testsuite name="Functional Tests">
            <directory>./tests/src/myApp/AppBundle/functional</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src/</directory>
        </whitelist>
    </filter>
</phpunit>

这里是测试class

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class MyTest extends WebTestCase
{
    private $client;

    public function setUp()
    {
        $this->client = static::createClient();
    }

当 运行 我在 setUp 中得到的测试:

Either set KERNEL_DIR in your phpunit.xml according to https://symfony.com/doc/current/book/testing.html#your-first-functional-test or override the WebTestCase::createKernel() method

<php> ... </php><testsuites>... 块移到它自己的 top-level。

这是我自己的主要项目的精简副本:

<phpunit 
    bootstrap = "app/bootstrap_test.php"
    verbose = "true"
>
    <php>
        <ini name="memory_limit" value="-1" />
        <!-- <server name="KERNEL_DIR" value="./app/" /> older-style -->
        <server name="KERNEL_CLASS" value="AppKernel" />
        <server name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
    </php>

    <testsuites>
        <testsuite name="project.name">
            <directory suffix=".php">./src/*Bundle</directory>
            <directory suffix=".php">./src/AppBundle</directory> -->
            <directory>./tests/App</directory>
        </testsuite>
    </testsuites>