Skip to content

Latest commit

 

History

History
105 lines (76 loc) · 3.49 KB

README.md

File metadata and controls

105 lines (76 loc) · 3.49 KB

PHP Testing tools

Build Status Code Climate license

This repository is a small Web application with a single feature with a single scenario. Its goal is to provide a set of examples using some of the coolest tools for testing and design in PHP.

It was used for a testing class. The slides are available here.

I'm also starting to use it to describe an hexagonal architecture in PHP.

Installation

It is recommended to use Docker and Docker Compose to run this example. However, it is also possible to install all the required software locally and run it without the containers.

All instructions below assume a Docker setup.

make containers     # Build the Docker images
source .alias       # Aliases to ease the use of the Docker containers
dev make bootstrap  # Install Composer dependencies for all applications

You may need a Github token as you will be running composer install for multiple applications. Please follow Composer documentation on OAuth tokens to use your newly created token with Composer. No need to do anything with your dev container, it is configured to share your local Composer configuration.

In order to run the application you'll need to seed the development database

dev make setup # Creates and seeds a development database

Usage

Web

You can run the Web application with this command:

web

Browse to http://localhost/ to see the web interface.

Console

You can transfer funds to another member like in the web application with this command:

console ewallet:transfer ABC LMN 5 # Transfers $5 MXN from sender with ID ABC to recipient with ID LMN 

Messaging

Both the Web and the console application generate domain events, those events send email notifications. Browse to http://localhost:8080/ to see the emails that are sent after transferring funds either from the console or the Web application.

To start the messaging container run this command:

messaging # Container with the cron jobs that send emails to MailCatcher based on the messages in RabbitMQ

Tests

Run the tests of all the applications and packages with this command:

dev make tests

Each folder in the ui and ewallet directories, has its own README file. Please read them for more details.