amivorti.blogg.se

Phpstorm phpunit
Phpstorm phpunit










phpstorm phpunit phpstorm phpunit

I’m not sure why it works like this, it seems to assume that it is run with the directory of the “phpunit” executable as working directory. I finally found out that the test runner that is generated by PhpStorm looks for “././vendor/autoload.php” or “./././vendor/autoload.php” within the include path. Now when you run a test file, or a phpunit.xml configuration in PhpStorm, the path is passed to our fake interpreter (test.sh) and … The project directory must be mounted to the exact same path as on the host because there are no path mappings for a local interpreter and host paths will be passed to PHPUnit.PhpStorm writes a temporary test runner to /tmp, so we mount the host /tmp directory to the container.But the two highlighted lines that are important for the PhpStorm integration: Yours will look different, whatever the needs of your PHP container are. config/php/ext-xdebug.ini:/usr/local/etc/php/conf.d/ext-xdebug.ini config/php/php.ini:/usr/local/etc/php/php.ini docker-compose Configurationįor me the “integration” container is defined like this in docker-compose.yml: I got the idea from this article and adapted it for docker-compose.ĭocker-compose run integration php “integration” is the name of the container. PhpStorm will not know that it runs in a container. The interpreter is actually a shell script that runs PHP in my container using docker-compose run. So instead of configuring the Remote PHP Interpreter for Docker, I created a local interpreter like this and selected it as the CLI interpreter for the project: If that’s not a problem for you, you will not need what I am going to explain here, read this instead: So for example my PHP container does not get access to the MySQL container for integration tests. Since PhpStorm 2013.2 there is a docker intergration which works well for single containers, but unfortunately it does not seem to use the running network of containers.

phpstorm phpunit

I wanted to run tests with PHPUnit on a docker environment, which was set up with docker-compose, and use the PhpStorm integration.












Phpstorm phpunit