Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/luc45/database-dumper-for-codeception

Easily generates database dumps to be used in Codeception.
https://github.com/luc45/database-dumper-for-codeception

Last synced: 7 days ago
JSON representation

Easily generates database dumps to be used in Codeception.

Awesome Lists containing this project

README

        

# Install

`composer require --dev lucasbustamante/db-dumper-for-codeception`

Add the command to your `codeception.yml`:
```
extensions:
commands:
- DumpGenerator\GenerateDump
```

On a suite that uses a `Codeception\Modules\Db` module (or any module that extends `Db`), add these parameters:

```
modules:
config:
Db:
dump_dsn: 'mysql:host=%DUMP_DB_HOST%;dbname=%DUMP_DB_NAME%'
dump_user: '%DUMP_DB_USER%'
dump_password: '%DUMP_DB_PASSWORD%'
```

Replace `%DUMP_DB_HOST%` and similars with your actual values. This should be your local development database, from which the dumps will be generated from.

# Usage

Run `./vendor/bin/codecept dump `

In the first run, a Dump config file will be generated at `tests/data/.sql.php` where you can fine-tune how your dump will be generated. On the subsequent runs, it will generate the dump based on the config. If you don't override any config, it will just do a full dump of the database.

This library is basically a Codeception wrapper around https://packagist.org/packages/ifsnop/mysqldump-php.

You can check their documentation to get more information on how exactly you can fine-tune your dump.