使用phpStorm在Symfony 3.2.4中进行功能测试 [英] Functional tests in Symfony 3.2.4 using phpStorm

查看:74
本文介绍了使用phpStorm在Symfony 3.2.4中进行功能测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Symfony 3.2.4中设置功能测试很困难.

I have difficulties setting up a functional test in Symfony 3.2.4.

namespace Tests\AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class ClinicalTrialsControllerTest extends WebTestCase
{
    public function testHTTPConnection()
    {
        $client = static::createClient();

未创建客户端,并且不断收到错误消息:

The client is not created and I constantly get an error message:

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中,内核目录设置为

In phpunit.dist.xml the kernel directory is set to

    <php>
        <ini name="error_reporting" value="-1" />
        <server name="KERNEL_DIR" value='app/' />
    </php>

关于如何设置内核目录的任何提示?

Any hints as to how to set the kernel directory?

推荐答案

我在phpunit.dist.xml中有以下内容:

I have this in my phpunit.dist.xml:

<php>
    <ini name="error_reporting" value="-1" />
    <server name="KERNEL_DIR" value="app/" />
</php>

为什么不更改它,看看是否可行?

Why don't you change it and see if that works?

这篇关于使用phpStorm在Symfony 3.2.4中进行功能测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆