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(2mo ago)2126.2k↑146.2%[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 1mo 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 1mo ago

READMEChangelog (7)Dependencies (9)Versions (14)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

47

—

FairBetter than 94% of packages

Maintenance66

Regular maintenance activity

Popularity34

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.3% 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

88d 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] (94 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)")[![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

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)

PHPackages © 2026

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