phpunit not using phpunit.xml settings

Posted 4 months ago by finchy70

My phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>

        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="MAIL_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="DB_DATABASE" value=":memory:"/>
    </php>
</phpunit>

When I run my tests with PHPStorm I get this error.

Testing started at 16:13 ...
/usr/local/Cellar/php/7.2.9_2/bin/php /Users/paulfinch/code/site/vendor/phpunit/phpunit/phpunit --no-configuration /Users/paulfinch/code/site/tests/Feature --teamcity
PHPUnit 7.5.4 by Sebastian Bergmann and contributors.


Illuminate\Database\QueryException : SQLSTATE[HY000] [1049] Unknown database 'site' (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')
 /Users/paulfinch/code/site/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
 /Users/paulfinch/code/site/vendor/laravel/framework/src/Illuminate/Database/Connection.php:624
 /Users/paulfinch/code/site/vendor/laravel/framework/src/Illuminate/Database/Connection.php:333
 /Users/paulfinch/code/site/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php:99
............

Was working fine so not sure whats happened.

Anyone having a simular problem?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.