【发布时间】:2016-04-04 20:11:07
【问题描述】:
我正在尝试在 Symfony 3 框架中进行单元测试。这是我的配置;
这是我面临的错误。
/Applications/MAMP/bin/php/php7.0.0/bin/php /private/var/folders/w9/cmwlplqx53x3slxkm4c1chx00000gn/T/ide-phpunit.php --bootstrap /Users/muhammetergenc/code/kampweb/phpunit.xml.dist --configuration /Users/muhammetergenc/code/kampweb/phpunit.xml.dist Tests\AppBundle\Controller\PersonTest /Users/muhammetergenc/code/kampweb/tests/AppBundle/Controller/PersonTest.php
Testing started at 3:04 PM ...
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="app/autoload.php">
<!-- <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="web/app_test.php">-->
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" />
</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>
Process finished with exit code 255
我在我的其他桌面上确实有相同的配置,它工作得很好。
【问题讨论】:
-
您已将其设置为使用 XML 文件作为引导文件,然后尝试将 XML 作为 PHP 运行并失败。
-
@JimL 如果不是扩展 PHPUnit 框架的 PHP 类,它不会被忽略吗?
-
我取消选中默认引导文件选项,但仍然收到相同的错误。 @JimL
标签: php unit-testing symfony