Skip to content

Commit

Permalink
Dedicated README explaining how to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienHarper committed Mar 4, 2019
1 parent f88565c commit 424328d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 11 deletions.
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,7 @@ Do not forget to provide unit tests when contributing to this project.
Tests
=====

To run the test suite, install dev dependencies first:

```bash
composer install --dev
```

Then run:

```bash
./vendor/bin/phpunit
```
Please, follow instructions in [this dedicated README](tests/README.md)


License
Expand Down
55 changes: 55 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Running Tests
=============

Before running the test suite, you first need to install dev dependencies:

```bash
composer install --dev
```

Then you can run the test suite with different configuration (SQLite, MySQL or PostgreSQL):

#### Default configuration (SQLite)

This configuration uses an in memory sqlite database, it's the fastest configuration.

```bash
./vendor/bin/phpunit
```
or
```bash
./vendor/bin/phpunit -c tests/travis/sqlite.travis.xml
```

#### MySQL configuration

This configuration expects to connect to a MySQL database.

```bash
./vendor/bin/phpunit -c tests/travis/mysql.travis.xml
```

**Note**: connection parameters (username, password, host, port, etc) are set in `./tests/travis/mysql.travis.xml` file.

Assuming you have docker installed, you can easily start a MySQL server with following command (MySQL 8)

```bash
docker run --name mysql_db -e MYSQL_DATABASE=doctrine_audit -d -p 3306:3306 mysql --default-authentication-plugin=mysql_native_password
```


#### PostgreSQL configuration

This configuration expects to connect to a PostgreSQL database.

```bash
./vendor/bin/phpunit -c tests/travis/pgsql.travis.xml
```

**Note**: connection parameters (username, password, host, port, etc) are set in `./tests/travis/pgsql.travis.xml` file.

Assuming you have docker installed, you can easily start a PostgreSQL server with following command (PostgreSQL 11)

```bash
docker run --name postgres_db -e POSTGRES_DB=doctrine_audit -d -p 5432:5432 postgres
```

0 comments on commit 424328d

Please sign in to comment.