JumpingJack_2
JumpingJack_2

Reputation: 91

Functional tests in Symfony 3.2.4 using phpStorm

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

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?

Upvotes: 2

Views: 755

Answers (2)

COil
COil

Reputation: 7606

It should be:

phpunit.xml.dist 

Not phpunit.dist.xml.

Upvotes: 2

Alvin Bunk
Alvin Bunk

Reputation: 7764

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?

Upvotes: 3

Related Questions