/automated_testing

A sample PHP application that implement automated testing.

Primary LanguagePHPMIT LicenseMIT

Build Status

PHP Automated testing

General

This project is used as a sample on how to write tests using Codeception library for a Laravel application.

Three test suites are included: Unit / Integration / Functional

Installation

Docker should be installed. For more information: click here

  • docker-compose up
  • docker exec -ti php bash
  • php artisan migrate:refresh --seed

Update your host file and create an entry: 127.0.0.1 automated_testing.dev

You can now access the app by visiting: http://automated_testing.dev

Run tests

Create test DB:

docker exec -ti mysql bash
mysql -uroot -proot -e 'CREATE DATABASE laravel_test;'

Test command:

docker exec -ti php bash
vendor/bin/codecept run

Test with coverage:

vendor/bin/codecept run --coverage --coverage-html

Reference