PHPackages                             vjik/codeception-db-populator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. vjik/codeception-db-populator

ActiveLibrary[Database &amp; ORM](/categories/database)

vjik/codeception-db-populator
=============================

Database populator for Codeception DB module

1.1.1(1y ago)22387BSD-3-ClausePHPPHP ^8.0

Since Sep 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vjik/codeception-db-populator)[ Packagist](https://packagist.org/packages/vjik/codeception-db-populator)[ RSS](/packages/vjik-codeception-db-populator/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

 [![](codeception-logo.png)](codeception-logo.png)

Database Populator for Codeception DB Module
============================================

[](#database-populator-for-codeception-db-module)

[![Latest Stable Version](https://camo.githubusercontent.com/61f35555d7339b7c32606a41154e5ff42b5908f9b28f9be436ad52b2e5ed85d5/68747470733a2f2f706f7365722e707567782e6f72672f766a696b2f636f646563657074696f6e2d64622d706f70756c61746f722f76)](https://packagist.org/packages/vjik/codeception-db-populator)[![Total Downloads](https://camo.githubusercontent.com/0e6d6719a3ca5081d588fc48d45f035c99aa13bd6365277129b8c106573ebeb7/68747470733a2f2f706f7365722e707567782e6f72672f766a696b2f636f646563657074696f6e2d64622d706f70756c61746f722f646f776e6c6f616473)](https://packagist.org/packages/vjik/codeception-db-populator)[![MySQL build](https://github.com/vjik/codeception-db-populator/actions/workflows/build-mysql.yml/badge.svg)](https://github.com/vjik/codeception-db-populator/actions/workflows/build-mysql.yml)[![PgSQL build](https://github.com/vjik/codeception-db-populator/actions/workflows/build-pgsql.yml/badge.svg)](https://github.com/vjik/codeception-db-populator/actions/workflows/build-pgsql.yml)[![static analysis](https://github.com/vjik/codeception-db-populator/actions/workflows/static.yml/badge.svg)](https://github.com/vjik/codeception-db-populator/actions/workflows/static.yml)[![License](https://camo.githubusercontent.com/7b5acc38dca4319a204a0464a7b523157310601a171712070a6df59bf10a36b5/68747470733a2f2f706f7365722e707567782e6f72672f766a696b2f636f646563657074696f6e2d64622d706f70756c61746f722f6c6963656e7365)](/LICENSE)

[Codeception](https://codeception.com/) DB module addon that helps you to tune database populations. So for a test you could load only needed tables or rows. As a result it dramatically reduces the total execution time.

Requirements
------------

[](#requirements)

- PHP 8.0 or higher.
- Codeception 5.0 or higher.
- Codeception Module DB 3.0 or higher.

Installation
------------

[](#installation)

The package could be installed with [composer](https://getcomposer.org/download/):

```
composer require vjik/codeception-db-populator --dev
```

General usage
-------------

[](#general-usage)

Enable module `Db` and `DatabasePopulator` addon in the suite:

```
modules:
  enabled:
    - Db:
        dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%'
        user: '%DB_USERNAME%'
        password: '%DB_PASSWORD%'
    - Vjik\Codeception\DatabasePopulator\Module:
        dumpsPath: 'tests/_data/dumps'
        rowsPath: 'tests/_data/rows'
```

Create SQL dumps that contains a record of the table structure and/or the data for use in tests. Put dumps into path, specified in options (for example, `tests/_data/dumps`).

Create row sets for populate database tables. Row sets is PHP file that return array in format `table => rows`. For example:

```
