![phpstorm dockerfile phpstorm dockerfile](https://miro.medium.com/max/1192/1*c01lW9H-DRjLhkmeITDPig.png)
The configuration, in this case, looks like this:
#PHPSTORM DOCKERFILE CODE#
At the same time, your major PHP container will not be killed, and you will be able to run your code from the web browser (or any other client for HTTP calls). You need to create another PHP container which will be used solely for Run/Debug Configurations in PhpStorm. To evade this side effect till JetBrains developers solve it, the community has worked out the easiest solution.
![phpstorm dockerfile phpstorm dockerfile](https://imgs.developpaper.com/imgs/26290246-11e81ca8fb40ac73_articlex.png)
When you write tests and features in IDE and then run tests, and after that switch to the browser and test the feature manually, you need to restart PHP container by hand because PhpStorm stops it after running your console script from the Run/Debug menu. This approach makes permanent development impossible. It can be observed from the results of test running from PhpStorm: Briefly, the matter is that when you set up running of Run Configuration from Docker, PhpStorm restarts the container with PHP any time the script is performed in it, and after that, the container is stopped. I recommend you to subscribe to them to remain informed. There is an issue where users suggest possible solutions, and there is also an issue where the fix for this problem is being planned. It is a well-known drawback which is discussed here. The plugin also can highlight in green or red the lines in your files which, correspondingly, are covered or not covered by tests:įor this plugin to work correctly in PhpStorm with PHP CLI configured from the Docker container, a range of additional actions should be taken.įirst, so far, the work with the already running containers has not been implemented correctly yet. That’s what the plugin in the form of a table with file and directory navigation shows. Using these statistics, we can calculate the percentage of the test code coverage since if there are operators in the file which have never been called during the tests, then, this piece of code is not covered by tests. This report will contain the information about the number of calls to each operator during tests execution. PhpUnit can be run with the options for generating code coverage report. There is a plugin PHPUnit Code Coverage which is used to display the code coverage with the PhpStorm tests.
#PHPSTORM DOCKERFILE HOW TO#
Let’s discuss how to fine-tune this process by means of Docker. One of such operations is running unit tests in the course of development. It allows the project participants to share common configurations using a ‘Shared’ flag in the settings. In PhpStorm, there is a possibility to create Run/Debug Configurations and to run them from IDE.