After digging deeper, I found this question on stack overflow from 5 days ago. Seems like I am not alone and it's being worked on by JetBrains!
https://stackoverflow.com/questions/76892846/phpstorm-is-not-applying-default-phpunit-configuration#
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, after switching to new laptop, my phpstorm installation is having trouble running tests directly from IDE from different than default /tests folder.
I am building a modular application and I have tests in multiple folders, for example Modules\Core\Tests.
When I right click a test method and run the test in default Laravel folder, it runs just fine. It runs just fine also by running php artisan test (all tests from all modules get run).
However, when I try to run the test directly from method (or class) in any of the Module folders, I get an error that PHPUnit is not configured. When I try to modify the latest test configuration, there is no phpunit.xml reference and when I force it and rerun the test, it works. Then, when I try to call it again just from IDE, I get the same error.
Has anyone encountered something similar? I think I am getting crazy, as everything seems to be set up exactly the same as on my old laptop and it's working without problems there.
Also an interesting thing: When I remove the PHPUnit test configuration and try to run the tests from default folder, I get the same error. However, when I click the recommended solution to "configure" the PHPUnit, it gets automatically filled in. It doesn't get filled in in the module folders.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./Modules/**/Tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./Modules/**/Tests/Unit</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
After digging deeper, I found this question on stack overflow from 5 days ago. Seems like I am not alone and it's being worked on by JetBrains!
https://stackoverflow.com/questions/76892846/phpstorm-is-not-applying-default-phpunit-configuration#
Please or to participate in this conversation.