我在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>
有关如何设置内核目录的任何提示?
答案 0 :(得分:3)
我的phpunit.dist.xml中有这个:
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" />
</php>
为什么不改变它,看看它是否有效?
答案 1 :(得分:1)
应该是:
phpunit.xml.dist
不是phpunit.dist.xml
。