Development environment for MySQL DBAL.
This repository contains everything you need to test MySQL DBAL. It consists of two interconnected Docker containers, one running PHP and another running either MySQL or MariaDB.
Docker Engine 1.13 or above.
Place a copy of MySQL DBAL under the repos
directory. You can use any cloning strategy you may like, just make sure the clone's path is repos/mysql-dbal
.
The following command line will use the Dockerfile under docker/php
to build a custom PHP image with Composer already installed:
$ docker-compose build php
Database images are pulled from Dockerhub, so there's no need to build them yourself.
You can run the tests either against MySQL or MariaDB.
The following command line will pull the MySQL image from Dockerhub, if necessary, and spin up a new container based on it:
$ docker-compose up -d db
The following command line will pull the MariaDB image from Dockerhub, if necessary, and spin up a new container based on it:
$ docker-compose -f docker-compose.yml -f docker-compose.mariadb.yml up -d db
To check if the container is running and the database configurations are correctly set up, you can use
$ docker exec -ti mysql-dbal-db mysql -u testdb -ptestdb testdb -e 'show databases;'
Spin up a new PHP container:
$ docker-compose run --rm php
From inside that container, install the Composer packages:
$ composer install
You can then run the tests:
$ DB_HOST=mysql-dbal-db \
DB_DATABASE=testdb \
DB_USERNAME=testdb \
DB_PASSWORD=testdb \
./vendor/bin/codecept run unit
To delete all containers, run
$ docker-compose down