PHPackages                             jacekk/codeception-dataprovider-module - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. jacekk/codeception-dataprovider-module

ActiveLibrary[Testing &amp; Quality](/categories/testing)

jacekk/codeception-dataprovider-module
======================================

Easy data providers in your Codeception tests.

v1.1.1(9y ago)312.6k11MITPHPPHP &gt;=5.4

Since Oct 2Pushed 9y ago2 watchersCompare

[ Source](https://github.com/jacekk/codeception-dataprovider-module)[ Packagist](https://packagist.org/packages/jacekk/codeception-dataprovider-module)[ RSS](/packages/jacekk-codeception-dataprovider-module/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (1)

Codeception DataProvider Module
===============================

[](#codeception-dataprovider-module)

[![Build Status](https://camo.githubusercontent.com/cd8aef149f4b419c7784ccc139687f257eb7223bf6a7f2fdf972862a6c8b260b/68747470733a2f2f7472617669732d63692e6f72672f6a6163656b6b2f636f646563657074696f6e2d6461746170726f76696465722d6d6f64756c652e737667)](https://travis-ci.org/jacekk/codeception-dataprovider-module)[![Total Downloads](https://camo.githubusercontent.com/6e1c6ec554fa23c264102c1de1adcf2fde9f5c23a36e52ac2b8fe659ff314be3/68747470733a2f2f706f7365722e707567782e6f72672f6a6163656b6b2f636f646563657074696f6e2d6461746170726f76696465722d6d6f64756c652f642f746f74616c2e737667)](https://packagist.org/packages/jacekk/codeception-dataprovider-module)[![Latest Stable Version](https://camo.githubusercontent.com/cf790be681ee8ea55a1b217ad97125f65c0d7ce9e702d7f77258f8bbcea7278d/68747470733a2f2f706f7365722e707567782e6f72672f6a6163656b6b2f636f646563657074696f6e2d6461746170726f76696465722d6d6f64756c652f762f737461626c652e737667)](https://packagist.org/packages/jacekk/codeception-dataprovider-module)[![Latest Unstable Version](https://camo.githubusercontent.com/f7f4c6abb22452382f692b392c6bbf41251aaa0167a32835b552de7c80f776e3/68747470733a2f2f706f7365722e707567782e6f72672f6a6163656b6b2f636f646563657074696f6e2d6461746170726f76696465722d6d6f64756c652f762f756e737461626c652e737667)](https://packagist.org/packages/jacekk/codeception-dataprovider-module)[![License](https://camo.githubusercontent.com/3e547f8234a998cc1c6e44ce1d793adb5fba1a4f2abdb435dd691adbb64f2d73/68747470733a2f2f706f7365722e707567782e6f72672f6a6163656b6b2f636f646563657074696f6e2d6461746170726f76696465722d6d6f64756c652f6c6963656e73652e737667)](https://packagist.org/packages/jacekk/codeception-dataprovider-module)

This module helps to manage data (that you use inside tests) in an easy way. Especially, when you like Yaml/YML files format.

- [Installation](#installation)
- [Parameters](#parameters)
- [Usage examples](#usage-examples)
- [License](#license)

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

[](#installation)

Add the package into your *composer.json* file:

```
{
    "require-dev": {
        "codeception/codeception": "2.*",
        "jacekk/codeception-dataprovider-module": "1.*"
    }
}
```

Tell Composer to download the package:

```
$ composer update

```

Then, enable it in your `my-awesome.suite.yml` configuration and adjust two required params as in [this library suite](test/tests/acceptance.suite.yml) config:

```
class_name: NoGuy
modules:
    enabled:
        - Asserts
        - DataProvider
    config:
        DataProvider:
            dataPathTpl: '{root}/tests/_data/{file}'
            files:
                - common-provider.yml
                - env-provider.dev.yml
```

You will need to rebuild your actor class:

```
$ php codecept.phar build

```

or

```
$ vendor/bin/codecept build
```

or whatever your tool set allowes :) At last, check out the [examples](#usage-examples) section and use it daily :)

Parameters
----------

[](#parameters)

#### dataPathTpl

[](#datapathtpl)

Template to build paths to files listed by appropriate setting. Allowes for the following tokens, where the first one is obviously required:

- `{file}` - one of elements listed in **files** setting,
- `{root}` - current working directory - PHP function: `getcwd()`.

#### files

[](#files)

One or more files names, which can be found under path defined in **dataPathTpl**. If `--env` param is used heavily, then some *files* reuse is sort of *built in*.

Usage examples
--------------

[](#usage-examples)

#### getValue($keyName, $default = null)

[](#getvaluekeyname-default--null)

YML content:

```
headers:
    contentType: 'application/json'
    accept: 'text/html'
```

PHP code:

```
public function testSomeHeaders(NoGuy $I)
{
    $headerValue = $I->getValue('headers.accept');
    $I->assertEquals('text/html', $headerValue);
    // or with somethin not set in YML files
    $authType = $I->getValue('headers.authorizationType', 'Bearer');
    $I->assertEquals('Bearer', $authType);
}
```

#### iterateOver($keyName, callable $callback)

[](#iterateoverkeyname-callable-callback)

YML content:

```
users:
    admins:
        0:
            id: 123
            email: John(at)example.com
            fullName: John Example
        1:
            id: 321
            email: two(at)gmail.com
            fullName: Tom The Second
```

or (this will also work, even it is not an ordered list):

```
users:
    admins:
        -
            id: 111
            email: mark(at)gmail.com
            fullName: Mark Whaleberg
```

PHP code:

```
public function testAdminsDataInUsersResource(NoGuy $I)
{
    $I->iterateOver('users.admins', function ($user, $index) use ($I) {
        $userId = $user['id'];
        $I->sendGET("users/{$userId}");
        $I->seeResponseContainsJson([
            'id'        => $userId,
            'is_admin'  => true,
            'email'     => $user['email'],
            'full_name' => $user['fullName'],
        ]);
    });
}
```

See more examples in [GetValueCest](test/tests/acceptance/GetValueCest.php) and [IterateOverCest](test/tests/acceptance/IterateOverCest.php) which verify this module quality.

License
-------

[](#license)

Released under the same licence as Codeception: MIT.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Recently: every ~30 days

Total

7

Last Release

3395d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.6

v1.1.1PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/74f051da236b554d2e02abde5679183528500c22300842c272cc483b070d32c9?d=identicon)[jacekk](/maintainers/jacekk)

---

Top Contributors

[![jacekk](https://avatars.githubusercontent.com/u/1695878?v=4)](https://github.com/jacekk "jacekk (7 commits)")

### Embed Badge

![Health badge](/badges/jacekk-codeception-dataprovider-module/health.svg)

```
[![Health](https://phpackages.com/badges/jacekk-codeception-dataprovider-module/health.svg)](https://phpackages.com/packages/jacekk-codeception-dataprovider-module)
```

###  Alternatives

[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[mcustiel/phiremock-codeception-extension

Codeception extension for Phiremock. Allows to stub remote services for HTTP requests.

311.0M5](/packages/mcustiel-phiremock-codeception-extension)[contributte/codeception

Integration of Nette framework to Codeception.

27886.9k1](/packages/contributte-codeception)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
