作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的 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>
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class MyTest extends WebTestCase
{
private $client;
public function setUp()
{
$this->client = static::createClient();
}
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>...
阻止到它自己的顶级。
这是我自己的主要项目的精简副本:
<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>
关于symfony - 如何在要求我在 phpunit.xml 中设置 KERNEL_DIR 的 PHPUnit 中解决此问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49096015/
在尝试 PHPUnit 功能测试时,我得到了 错误: 1) TreningBundle\Tests\Controller\DefaultControllerTest::testIndex Runtim
我正在尝试为我的 Silex 应用程序设置单元测试,但我不断收到此错误消息: RuntimeException: Either set KERNEL_DIR in your phpunit.xml a
这是我的 phpunit.xml 文件 ./tests/
我是一名优秀的程序员,十分优秀!