项目作者: MontealegreLuis

项目描述 :
Code examples with several PHP testing tools
高级语言: PHP
项目地址: git://github.com/MontealegreLuis/php-testing-tools.git
创建时间: 2015-07-04T22:34:48Z
项目社区:https://github.com/MontealegreLuis/php-testing-tools

开源协议:MIT License

下载


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.

  1. make containers # Build the Docker images
  2. source .alias # Aliases to ease the use of the Docker containers
  3. 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

  1. dev make setup # Creates and seeds a development database

Usage

Web

You can run the Web application with this command:

  1. 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:

  1. 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:

  1. 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:

  1. dev make tests

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