PHPackages                             lendable/phpunit-extensions - 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. lendable/phpunit-extensions

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

lendable/phpunit-extensions
===========================

Extensions to PHPUnit

0.5.0(4mo ago)2138.3k↑402.6%[2 issues](https://github.com/Lendable/phpunit-extensions/issues)[5 PRs](https://github.com/Lendable/phpunit-extensions/pulls)3MITPHPPHP ^8.4CI passing

Since Nov 26Pushed 2w ago33 watchersCompare

[ Source](https://github.com/Lendable/phpunit-extensions)[ Packagist](https://packagist.org/packages/lendable/phpunit-extensions)[ RSS](/packages/lendable-phpunit-extensions/feed)WikiDiscussions main Synced yesterday

READMEChangelog (7)Dependencies (9)Versions (15)Used By (3)

Lendable PHPUnit Extensions
===========================

[](#lendable-phpunit-extensions)

Warning

This library is still in early development.

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

[](#installation)

Install through Composer:

```
composer require --dev lendable/phpunit-extensions
```

Features
--------

[](#features)

### Strict mocking

[](#strict-mocking)

By default, when creating a mock all method return values are stubbed based on typing information. E.g.

```
public function foo(): int
{
    return $this->foo;
}
```

Will be stubbed to return `0`. This library ships two mechanisms to simplify disabling this functionality to force all methods called on a mock to be configured explicitly.

- If you extend from `Lendable\PHPUnitExtensions\TestCase`, this will be enabled. If you can just extend from this class it is the simplest way to opt-in to all functionality.
- The trait `Lendable\PHPUnitExtensions\StrictMocking` is provided to enable this alone. If you are forced into using another abstract `*TestCase` (e.g. from a vendor) this can be added into the class hierarchy.

PHPStan
-------

[](#phpstan)

A PHPStan extension is provided to enforce usage of features of this library.

Add the rules into your PHPStan configuration:

```
rules:
    # ...
    - vendor/lendable/phpunit-extensions/phpstan/rules.neon
```

Configure any exclusions you may have:

```
lendable_phpunit:
    enforceStrictMocking:
        pardoned:
            - Foo\Bar\MyTest
```

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance67

Regular maintenance activity

Popularity35

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.6% 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 ~136 days

Recently: every ~168 days

Total

7

Last Release

134d ago

PHP version history (4 changes)0.1.0PHP ^8.1

0.3.0PHP ^8.2

0.4.0PHP ^8.3

0.5.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/893f1dc6753940f80d1fe2e9a90db68961bb7f16eab85d6a868e7aecccf8de13?d=identicon)[ben-challis](/maintainers/ben-challis)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (100 commits)")[![ben-challis](https://avatars.githubusercontent.com/u/8275163?v=4)](https://github.com/ben-challis "ben-challis (13 commits)")[![marmichalski](https://avatars.githubusercontent.com/u/57528542?v=4)](https://github.com/marmichalski "marmichalski (5 commits)")[![lendabot[bot]](https://avatars.githubusercontent.com/u/10513749?v=4)](https://github.com/lendabot[bot] "lendabot[bot] (3 commits)")[![AlexisColes](https://avatars.githubusercontent.com/u/8488871?v=4)](https://github.com/AlexisColes "AlexisColes (1 commits)")[![velkovb](https://avatars.githubusercontent.com/u/10958657?v=4)](https://github.com/velkovb "velkovb (1 commits)")[![X-Coder264](https://avatars.githubusercontent.com/u/12602463?v=4)](https://github.com/X-Coder264 "X-Coder264 (1 commits)")

###  Code Quality

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lendable-phpunit-extensions/health.svg)

```
[![Health](https://phpackages.com/badges/lendable-phpunit-extensions/health.svg)](https://phpackages.com/packages/lendable-phpunit-extensions)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k136.1M985](/packages/brianium-paratest)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M344](/packages/drupal-core-dev)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

30314.4k7](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

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