2

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?

2
  • Weird to have this value for KERNEL_DIR the default one is app/ like the answer below. Commented Apr 20, 2017 at 19:27
  • how did you run the phpunit? Commented Apr 21, 2017 at 8:19

2 Answers 2

3

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?

Sign up to request clarification or add additional context in comments.

1 Comment

I have tried 'app/', as well as full path or relative path, but it did'nt change anything
2

It should be:

phpunit.xml.dist 

Not phpunit.dist.xml.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.