PHPackages                             ecomdev/testcontainers-magento-data - 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. ecomdev/testcontainers-magento-data

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

ecomdev/testcontainers-magento-data
===================================

TestContainers for Magento data in integration/functional tests

v1.2.0(1y ago)443812MITPHPPHP ~8.2.0||~8.3.0||~8.4.0CI passing

Since Jan 7Pushed 1y agoCompare

[ Source](https://github.com/EcomDev/testcontainer-magento-data-php)[ Packagist](https://packagist.org/packages/ecomdev/testcontainers-magento-data)[ RSS](/packages/ecomdev-testcontainers-magento-data/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (5)Used By (2)

🐳 Test-Containers for Quick Magento Development
===============================================

[](#-test-containers-for-quick-magento-development)

[![Docker Build](https://github.com/EcomDev/testcontainer-magento-data/actions/workflows/docker-images.yml/badge.svg)](https://github.com/EcomDev/testcontainer-magento-data/actions/workflows/docker-images.yml)[![PHP Package](https://github.com/EcomDev/testcontainer-magento-data-php/actions/workflows/php-package.yml/badge.svg)](https://github.com/EcomDev/testcontainer-magento-data-php/actions/workflows/php-package.yml)

This package simplifies the process of automated testing with real database and search engine

✨ Features
----------

[](#-features)

- 📦 **Pre-configured database and search containers**: Instantly spin up containers with ready-to-use Magento data
- ⚙️ **Easy setup and use**: Use PHP package to automatically discard container after tests
- 🎯 **Blazingly Fast**: Container takes only few seconds to start, so you can focus on testing instead of waiting for db initialization

📋 Requirements
--------------

[](#-requirements)

- **🐳 Docker**: Ensure Docker is installed and operational on your system.

📦 Available images
------------------

[](#-available-images)

All the available Docker image version can be found in build repository [EcomDev/testcontainer-magento-data](https://github.com/EcomDev/testcontainer-magento-data?tab=readme-ov-file#-available-images)

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

[](#installation)

Use composer with `--dev` flag to add it as dependency for your tests

```
composer require --dev ecomdev/testcontainers-magento-data
```

Examples
--------

[](#examples)

### MySQL container

[](#mysql-container)

Create Latest Magento Database Build

```
use EcomDev\TestContainers\MagentoData\DbContainerBuilder;

$container = DbContainerBuilder::mysql()
    ->build();
```

Create Latest Magento Database Build with sample data

```
use EcomDev\TestContainers\MagentoData\DbContainerBuilder;

$container = DbContainerBuilder::mysql()
    ->withSampleData()
    ->build();
```

Create 2.4.7-p2 with sample data and fetch number of products

```
use EcomDev\TestContainers\MagentoData\DbContainerBuilder;
use PDO;

$container = DbContainerBuilder::mysql()
    ->withMagentoVersion('2.4.7-p2')
    ->withSampleData()
    ->build();

$connectionSettings = $container->getConnectionSettings();
$connection = new PDO(
    $connectionSettings->dsn(),
    $connectionSettings->user,
    $connectionSettings->password
);

$result = $connection->query('SELECT COUNT(*) FROM catalog_product_entity');
// Outputs 2040
echo $result->fetch(PDO::FETCH_COLUMN);
```

### MariaDB container

[](#mariadb-container)

Everything the same as for MySQL container, just a different builder method

```
use EcomDev\TestContainers\MagentoData\DbContainerBuilder;

$container = DbContainerBuilder::mariadb()
    ->withMagentoVersion('2.4.7-p2')
    ->withSampleData()
    ->build();
```

OpenSearch container
--------------------

[](#opensearch-container)

For OpenSearch container there is a different builder and container, that allows building base url for http connection

Here is a small example

```
use EcomDev\TestContainers\MagentoData\OpenSearchContainerBuilder;
use GuzzleHttp\Client;

$container = OpenSearchContainerBuilder::new()
            ->withSampleData()
            ->build();

$client = new Client([
    'base_uri' => $container->getBaseUrl()
]);

$result = json_decode(
    $client->get('magento2_product_1/_count')->getBody()->getContents(),
    true
);

// Outputs 181
echo $result['count'];
```

📜 License
---------

[](#-license)

This project is licensed under the MIT License.

See the [LICENSE](LICENSE) file for more details.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance42

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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 ~8 days

Total

3

Last Release

481d ago

PHP version history (3 changes)v1.0.0PHP ^8.3

v1.1.0PHP ~8.2.0||~8.3.0

v1.2.0PHP ~8.2.0||~8.3.0||~8.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/190d12eae43e0d874394cbc7fc49ea94c6b6e1bc8b05f75b94fbd0b9c4b5d15f?d=identicon)[IvanChepurnyi](/maintainers/IvanChepurnyi)

---

Top Contributors

[![IvanChepurnyi](https://avatars.githubusercontent.com/u/866758?v=4)](https://github.com/IvanChepurnyi "IvanChepurnyi (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ecomdev-testcontainers-magento-data/health.svg)

```
[![Health](https://phpackages.com/badges/ecomdev-testcontainers-magento-data/health.svg)](https://phpackages.com/packages/ecomdev-testcontainers-magento-data)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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