Skip to content

Latest commit

 

History

History
112 lines (59 loc) · 2.63 KB

File metadata and controls

112 lines (59 loc) · 2.63 KB

Workshop Contract Testing

Demo project for demonstrating the functionality and power of contract testing.

Contract testing is done with Pact.

Requirements

This demo contains a Vagrant + Docker setup. Docker native (without Vagrant) may work but is not really supported.

Installation

@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/stop environment

Start

@guest:$ ./bin/start

Stop

@guest:$ ./bin/stop

Project Overview

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

Services

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

Frontend

Consumer Tests:

@container:$ ./bin/phpunit-contract-consumer-user
@container:$ ./bin/phpunit-contract-consumer-recipe-detail
@container:$ ./bin/phpunit-contract-consumer-recipe-search

Recipe Service

User Service

Provider Test:

@container:$ ./bin/phpunit

RecipeSearch Service

RecipeDetail Service

PactBroker

From any service within the environment the broker is available under

http://pact-broker:9292

Debugging

export XDEBUG_CONFIG="idekey=PHPSTORM"
export PHP_IDE_CONFIG="serverName=recipe-search.workshop"
bin/phpunit ...