PHPackages                             keboola/datadir-tests - 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. keboola/datadir-tests

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

keboola/datadir-tests
=====================

Tool for functional testing of Keboola Connection components

6.0.0(3mo ago)264.8k—6%[3 issues](https://github.com/keboola/datadir-tests/issues)5MITPHPPHP ^8.2CI passing

Since Apr 16Pushed 3mo ago15 watchersCompare

[ Source](https://github.com/keboola/datadir-tests)[ Packagist](https://packagist.org/packages/keboola/datadir-tests)[ RSS](/packages/keboola-datadir-tests/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (27)Used By (5)

Datadir Tests
=============

[](#datadir-tests)

[![GitHub Actions](https://github.com/keboola/datadir-tests/actions/workflows/push.yml/badge.svg)](https://github.com/keboola/datadir-tests/actions/workflows/push.yml)

Usage
=====

[](#usage)

Require this package in you component

```
composer require keboola/datadir-tests`
```

In the tests folder create a directory structure mimicking the directory structure in production:

```
/path/to/tests
└─test-name
  ├─expected-code
  ├─expected-stdout (optional)
  ├─expected-stderr (optional)
  ├─expected
  │ └─data
  │   └─out
  │     ├─files
  │     └─tables
  ├─source
  │ └─data
  │   └─in
  │     ├─files
  │     └─tables
  └─config.json

```

Note: `expected-stdout` and `expected-stderr`are compared with real output using [`assertStringMatchesFormat`](https://phpunit.readthedocs.io/en/9.3/assertions.html#assertstringmatchesformat) method, so you can use [placeholders](https://phpunit.readthedocs.io/en/9.5/assertions.html#assertstringmatchesformat).

Then create empty `/path/to/tests/DatadirTest` that extends `Keboola\DatadirTests\DatadirTestCase`:

```
