Demo project for demonstrating the functionality and power of contract testing.
Contract testing is done with Pact.
This demo contains a Vagrant + Docker setup. Docker native (without Vagrant) may work but is not really supported.
@host:$ vagrant up
@host:$ vagrant ssh
@guest:$ cd /vagrant
@guest:$ ./bin/install
Joining the workshop? Then stop reading and look forward to the upcoming Symfony Live Berlin 2018 :)
Start
@guest:$ ./bin/start
Stop
@guest:$ ./bin/stop
Services:
- frontend: the UI
- recipe-detail: holds all details of a recipe and according data
- recipe: service for basic recipe data
- user: service for basic user data
- recipe-search: service for searching for recipes
For running the tests the complete environment has to be started.
@guest:$ ./bin/start
Afterwards you have to jump in the according service for executing the tests
@guest:$ ./bin/enter frontend
Consumer Tests:
@container:$ ./bin/phpunit-contract-consumer-user
@container:$ ./bin/phpunit-contract-consumer-recipe-detail
@container:$ ./bin/phpunit-contract-consumer-recipe-search
Provider Test:
@container:$ ./bin/phpunit
-
http://192.168.33.10:8083/api?needle=lorem&limit=2
http://192.168.33.10:8083/api http://192.168.33.10:8083/api?needle=lorem&limit=2
From any service within the environment the broker is available under
http://pact-broker:9292
export XDEBUG_CONFIG="idekey=PHPSTORM"
export PHP_IDE_CONFIG="serverName=recipe-search.workshop"
bin/phpunit ...