Shared on Mage Dispatch · 14 Jan 2025

Essentials for testing Magento 2 modules

Using mocking frameworks for testing Magento 2 modules is counterproductive as you replicate line by line your actual calls to a magento implementation.

Binding your tests to the details of implementation leads to very fragile test suite that no-one wants to work with afterwards as a small change in underlying code like extraction of the class requires complete rewrite of the test case.

This package solves this problem by providing fake objects for most common operations you might want to interact with core.

4
18
Visit link → https://github.com/EcomDev/magento2-test-essentials

More like this

New here? This is Mage Dispatch

Mage Dispatch is a community-run archive and bi-weekly newsletter for the Magento, Adobe Commerce and Mage-OS ecosystem. Modules, articles, security advisories and tools, hand-picked by developers and shared so good work does not disappear into the void.

Browse the latest links → Explore by topic → Submit a link → About us →