【发布时间】:2017-04-20 19:11:13
【问题描述】:
我在 Symfony 3.2.4 中设置功能测试时遇到困难。
namespace Tests\AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class ClinicalTrialsControllerTest extends WebTestCase
{
public function testHTTPConnection()
{
$client = static::createClient();
客户端未创建,我不断收到错误消息:
Unable to guess the Kernel directory.
/Applications/MAMP/htdocs/Symfony/coremed/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:57
/Applications/MAMP/htdocs/Symfony/coremed/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:118
/Applications/MAMP/htdocs/Symfony/coremed/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:164
/Applications/MAMP/htdocs/Symfony/coremed/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:145
/Applications/MAMP/htdocs/Symfony/coremed/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33
/Applications/MAMP/htdocs/Symfony/coremed/Tests/Controller/ClinicalTrialsControllerTest.php:17
在 phpunit.dist.xml 内核目录设置为
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value='app/' />
</php>
关于如何设置内核目录的任何提示?
【问题讨论】:
-
奇怪的是 KERNEL_DIR 有这个值,默认值是
app/,如下面的答案。 -
你是如何运行 phpunit 的?
标签: symfony unit-testing functional-testing