Symfony 3.4 PHP unit Unable to guess kernel directory

Viewed 387

Alright so I am trying to run a command that starts one of my tests, but no matter what I always get an error saying Unable tot guess kernel directory

I tried editing the phpunit.xml.dist but still nothing.

I am using Symfony 3.4, and this is my phpunit.xml.dist

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



<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
    backupGlobals               = "false"
    backupStaticAttributes      = "false"
    colors                      = "true"
    convertErrorsToExceptions   = "true"
    convertNoticesToExceptions  = "true"
    convertWarningsToExceptions = "true"
    processIsolation            = "false"
    stopOnFailure               = "false"
    syntaxCheck                 = "false"
    bootstrap                   = "bootstrap.php.cache" >

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>../src/*/*Bundle/Tests</directory>
            <directory>../src/*/Bundle/*Bundle/Tests</directory>
        </testsuite>
    </testsuites>

    <php>
        <var name="TEST_DB_DSN" value="mysql:dbname=db_test;host=localhost" />
        <var name="TEST_DB_USER" value="root" />
        <var name="TEST_DB_PASSWD" value="test123" />
        <var name="TEST_DB_DBNAME" value="db_test" />

        <ini name="error_reporting" value="-1" />
        <server name="KERNEL_CLASS" value="AppKernel" />
        <server name="KERNEL_DIR" value="app/" />
        <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
    </php>

    <filter>
        <whitelist>
            <directory>../src</directory>
            <exclude>
                <directory>../src/*/*Bundle/Resources</directory>
                <directory>../src/*/*Bundle/Tests</directory>
                <directory>../src/*/Bundle/*Bundle/Resources</directory>
                <directory>../src/*/Bundle/*Bundle/Tests</directory>
            </exclude>
        </whitelist>
    </filter>

</phpunit>

And this is my test controller

<?php

namespace SiteBundle\Tests\Controller\Submission;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class BikeSubmissionControllerTest extends WebTestCase
    {
    public function testPost()
        {
        $client = static::createClient();
        $client->followRedirects();
        }
    }

And this is the command I am trying to run

php bin/phpunit src/SiteBundle/Tests/Controller/Submission/BikeSubmissionControllerTest.php

I also tried using it with the '-c' but then I get an error saying that I am trying to re-declare kernel class

0 Answers
Related