Install drupal core dev dependencies.
ddev composer require drupal/core-dev --dev -W
This will include everything you need for code quality and test tools.
Take a look at the package requirements to see the dependencies it pulls in, like drupal/coder and phpunit/phpunit.
In PHPStorm, install the DDEV plugin, which will recognize the container and configure a php cli interpreter to run inside.
*Since php is running inside the container, any paths used in tooling config should use the mapped path in the container (/var/www/html).
Copy web/core/php.xml.dist to the project root. (remove or rename web if your webroot is different).
Make these changes:
- bootstrap="
web/core/tests/bootstrap.php" SIMPLETEST_BASE_URL="http://localhost"SIMPLETEST_DB="mysql://db:db@db/simpletest"
In PHPStorm settings, go to PHP > Test Frameworks.
Set Default configuration file to /var/www/html/phpunit.xml.
Now you can use the green play arrow that appears in test files to run the test.