0

I need help regarding this, documentation doesn't help.

I have app/AppKernel.php, I don't use a custom kernel, however the functional test does not run.

phpunit.xml.dist:

<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
         backupGlobals="false"
         colors="true"
         bootstrap="app/autoload.php"
>
    <php>
        <ini name="error_reporting" value="-1" />
        <server name="KERNEL_DIR" value="app" />
    </php>

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>src</directory>
            <exclude>
                <directory>src/*Bundle/Resources</directory>
                <directory>src/*/*Bundle/Resources</directory>
                <directory>src/*/Bundle/*Bundle/Resources</directory>
            </exclude>
        </whitelist>
    </filter>
</phpunit>

The error:

/usr/bin/php /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/phpunit/phpunit/phpunit --no-configuration /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/tests --teamcity
Testing started at 21:35 ...
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.


Either set KERNEL_DIR in your phpunit.xml according to https://symfony.com/doc/current/book/testing.html#your-first-functional-test or override the WebTestCase::createKernel() method.
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:126
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:165
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:146
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/tests/AppBundle/Controller/Security/LoginControllerAcceptanceTest.php:19
1
  • where's your phpunit.xml.dist file located? Commented Jul 11, 2017 at 5:45

1 Answer 1

1

You run phpunit with --no-configuration which prevents phpunit from loading the configuration file.

Either load the file, or set the KERNEL_DIR as an environment variable.

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

1 Comment

Thanks, I'm running it through PHPStorm right click -> Run. I will check if I can configure it

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.