Search code examples
laraveldockerphpunitdocker-composebehat

How to install Behat in docker container for Laravel environment using docker-compose?


I have a docker container with laravel environment , and I need to install Behat inside to run features and i need to run PHPunit tests.

Any suggestion how to do it?

UPDATED:

I have this environment Dockervel : http://www.spiralout.eu/2015/12/dockervel-laravel-development.html

I have to do some application whit BDD done in Behat and also I need to do some unit testing. I have to deliver this application via Docker image.

I have wrote the application in dockervel ,it's pretty simple one ,but still need to add behat and to make a Dockerfile so I can make an image.


Solution

  • Run composer install behat/behat in your application code container and run the commands like any other php / laravel package.

    I don't think that adding a separate container just for testing / behat / phpunit is really anything better than having them all in the same container.

    On the other hand, NodeJS and npm in a separate container would be a smart choice in some cases.