PHPackages                             bkubicki/magento2-unit-tests-doubles - 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. bkubicki/magento2-unit-tests-doubles

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

bkubicki/magento2-unit-tests-doubles
====================================

Unit tests doubles for Magento 2

1.2.0(4y ago)113.9k↓33.3%11MITPHPPHP ^7.4CI failing

Since Sep 10Pushed 4y ago2 watchersCompare

[ Source](https://github.com/bartoszkubicki/magento2-unit-tests-doubles)[ Packagist](https://packagist.org/packages/bkubicki/magento2-unit-tests-doubles)[ RSS](/packages/bkubicki-magento2-unit-tests-doubles/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (8)Versions (12)Used By (1)

BKubicki Magento 2 Unit Tests Doubles
=====================================

[](#bkubicki-magento-2-unit-tests-doubles)

Overview
--------

[](#overview)

Library provides useful doubles of different kinds for unit testing of Magento 2.3+. Some of the doubles can be created using dedicated builders, which helps in configuring desired behavior of doubles. By using these doubles you can get rid of over-mocking in unit tests and time spent on writing unit should decrease. It can be achieved because all doubles inherits or implements replaced object or interface, so type consistency is preserved. Examples in [here](EXAMPLES.md).

Prerequisites
-------------

[](#prerequisites)

- PHP ^7.4

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

[](#installation)

To install the extension use the following commands:

```
 composer require bkubicki/magento2-unit-tests-doubles
```

Tests
-----

[](#tests)

### Unit

[](#unit)

Run command

```
composer test-unit-coverage

```

which is an alias for

```
./vendor/bin/phpunit -c phpunit.xml --testsuite "Unit" --coverage-html coverage/coverage-html --colors=always

```

### Integration

[](#integration)

Run command

```
composer test-integration

```

which is an alias for

```
./vendor/bin/phpunit -c phpunit.xml --testsuite "Integration" --colors=always

```

### Mutation tests (using Infection)

[](#mutation-tests-using-infection)

1. Infection tests requires xDebug enabled.
2. Run command

    ```
    composer test-infection

    ```

    which does the following:

    - Run PHPUnit tests and generate coverage in xml: ```
        ./vendor/bin/phpunit -c phpunit.xml --testsuite "Unit" --coverage-xml coverage/coverage-xml --log-junit coverage/phpunit.junit.xml

        ```
    - Run Infection mutation tests for covered code ```
        ./vendor/bin/infection --coverage=coverage --only-covered --show-mutations

        ```
3. Find detailed report from mutations in `var/log/dev/infection.log`.

Versioning
----------

[](#versioning)

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/bartoszkubicki/magento2-unit-tests-doubles/tags).

Changelog
---------

[](#changelog)

See changelog [here](CHANGELOG.md).

Authors
-------

[](#authors)

- [Bartosz Kubicki](https://github.com/bartoszkubicki)

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 61.5% 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 ~97 days

Recently: every ~184 days

Total

9

Last Release

1660d ago

PHP version history (3 changes)1.0PHP ^7.2.0

1.1.3PHP ^7.2.0|~7.3.0

1.1.4PHP ^7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20238194?v=4)[Bartosz Kubicki](/maintainers/bartoszkubicki)[@bartoszkubicki](https://github.com/bartoszkubicki)

---

Top Contributors

[![bartoszkubicki](https://avatars.githubusercontent.com/u/20238194?v=4)](https://github.com/bartoszkubicki "bartoszkubicki (8 commits)")[![schmengler](https://avatars.githubusercontent.com/u/367320?v=4)](https://github.com/schmengler "schmengler (5 commits)")

---

Tags

magentomagento2magento2-extensionmagento2-modulemockmockingovermockingphpunitstubstubbingunit-testunit-testingmagento2

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bkubicki-magento2-unit-tests-doubles/health.svg)

```
[![Health](https://phpackages.com/badges/bkubicki-magento2-unit-tests-doubles/health.svg)](https://phpackages.com/packages/bkubicki-magento2-unit-tests-doubles)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[tddwizard/magento2-fixtures

Fixture library for Magento 2 integration tests

146438.6k9](/packages/tddwizard-magento2-fixtures)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[bex/behat-magento2-extension

Magento2 extension for Behat

11111.2k](/packages/bex-behat-magento2-extension)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

119.1k](/packages/opengento-module-category-import-export)

PHPackages © 2026

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