Overview
Magento 2's stock integration test framework boots the entire application, runs DI compilation, and executes slow setup scripts before running a single assertion. Conversely, pure mock-based unit tests quickly become brittle mirrors of internal method calls.
EcomDev/magento2-test-essentials provides clean, composable fake implementations of core Magento infrastructure services, giving you real behavior and real database queries without booting the whole framework.
Installation
composer require --dev ecomdev/magento2-test-essentialsKey Building Blocks
ObjectManagerFake: Register only the collaborators your subject under test actually needs.StoreManager&ScopeConfigFakes: Configure multi-website, multi-store hierarchies and scoped config values in a few lines of PHP.DeploymentConfig&ResourceConnectionFakes: Wire Magento resource models directly to a livetestcontainer-magento-data-phpdatabase container.
Related Projects
- MySQL Test Utils: Ephemeral per-test MySQL databases for PHPUnit
- Testcontainer Magento Data (PHP): Sub-second pre-seeded Magento MySQL & OpenSearch containers
- Magento Testcontainers v2: 88% Smaller Images, 4.3× Faster Tests: Benchmarks showing 120 real integration tests finishing in 1.45s