PHPackages                             bluepsyduck/test-helper - 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. bluepsyduck/test-helper

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

bluepsyduck/test-helper
=======================

Some traits helping with testing using PHPUnit.

2.0.0(5y ago)040.8k↓42.9%20GPL-3.0-or-laterPHPPHP ^7.4 | ^8.0

Since Apr 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/BluePsyduck/test-helper)[ Packagist](https://packagist.org/packages/bluepsyduck/test-helper)[ Docs](https://github.com/BluePsyduck/test-helper)[ RSS](/packages/bluepsyduck-test-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (20)

BluePsyduck's Test Helper
=========================

[](#bluepsyducks-test-helper)

[![GitHub release (latest SemVer)](https://camo.githubusercontent.com/154c926db0b7d64cea0dbaa6daaec3ab92d93706f5395feb19a73be05a534d04/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f426c75655073796475636b2f746573742d68656c706572)](https://github.com/BluePsyduck/test-helper/releases)[![GitHub](https://camo.githubusercontent.com/471bfc096c11e6b988148819d591fe1b571b06bc31612b27b8f3bcca34c0bac3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f426c75655073796475636b2f746573742d68656c706572)](LICENSE.md)[![build](https://camo.githubusercontent.com/49b7c9c1c325bb6ca7c4c4a5a375ed94a6ddf99b3f51b1dc60514d2913143ccf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f426c75655073796475636b2f746573742d68656c7065722f43493f6c6f676f3d676974687562)](https://github.com/BluePsyduck/test-helper/actions)[![Codecov](https://camo.githubusercontent.com/588d010918ddc47a34e94ee09be0e97beecb61ee92d27184327b8fe46243ae52/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f426c75655073796475636b2f746573742d68656c7065723f6c6f676f3d636f6465636f76)](https://codecov.io/gh/BluePsyduck/test-helper)

This library contains a trait helping with testing classes using PHPUnit by providing some shortcut methods for the test cases.

ReflectionTrait
---------------

[](#reflectiontrait)

The `ReflectionTrait` is a trait which adds methods for easier access to non-public properties and methods, making mocking them easier. The trait comes with the following methods:

- `injectProperty($object, $name, $value)`: Injects the value to a property of the object.
- `injectStaticProperty($className, $name, $value)`: Injects the value to a static property of the class.
- `extractProperty($object, $name)`: Extracts the value of a property from the object.
- `extractStaticProperty($className, $name)`: Extracts the value of a static property from the class.
- `invokeMethod($object, $name, ...$params)`: Invokes a non-public method on the object.
- `invokeStaticMethod($className, $name, ...$params)`: Invokes a non-public static method on the class.

Note: The parameters passed to `invokeMethod()` and `invokeStaticMethod()` are passed-by-value. If the method uses references, the changes made by the method will not be visible to the outside.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~629 days

Total

2

Last Release

1952d ago

Major Versions

1.0.0 → 2.0.02021-01-12

PHP version history (2 changes)1.0.0PHP &gt;=7.0

2.0.0PHP ^7.4 | ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0409c6a7a462814e06b0ae7d5bb8deb52789b0b5543305e4143ff3ab823838e?d=identicon)[BluePsyduck](/maintainers/BluePsyduck)

---

Top Contributors

[![BluePsyduck](https://avatars.githubusercontent.com/u/1012405?v=4)](https://github.com/BluePsyduck "BluePsyduck (9 commits)")

---

Tags

phpunithelperBluePsyduck

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bluepsyduck-test-helper/health.svg)

```
[![Health](https://phpackages.com/badges/bluepsyduck-test-helper/health.svg)](https://phpackages.com/packages/bluepsyduck-test-helper)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k910.7M134.8k](/packages/phpunit-phpunit)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[johnkary/phpunit-speedtrap

Find and report on slow tests in your PHPUnit test suite

78337.2M122](/packages/johnkary-phpunit-speedtrap)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69617.9M510](/packages/spatie-phpunit-snapshot-assertions)[dg/bypass-finals

Removes final keyword from source code on-the-fly and allows mocking of final methods and classes

57026.3M456](/packages/dg-bypass-finals)[phpspec/prophecy-phpunit

Integrating the Prophecy mocking library in PHPUnit test cases

19454.9M1.4k](/packages/phpspec-prophecy-phpunit)

PHPackages © 2026

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