PHPackages                             wikimedia/testing-access-wrapper - 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. wikimedia/testing-access-wrapper

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

wikimedia/testing-access-wrapper
================================

A simple helper class to access non-public elements of a class when testing.

4.0.0(6mo ago)42.0M—3.5%112GPL-2.0-or-laterPHPPHP &gt;=8.1

Since Apr 19Pushed 2mo ago10 watchersCompare

[ Source](https://github.com/wikimedia/testing-access-wrapper)[ Packagist](https://packagist.org/packages/wikimedia/testing-access-wrapper)[ Docs](https://www.mediawiki.org/wiki/Testing-access-wrapper)[ RSS](/packages/wikimedia-testing-access-wrapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (5)Used By (12)

[![Latest Stable Version](https://camo.githubusercontent.com/e71003f441d4fa384e95bff6754c9a4f0e5179a9a43da20ee0be2892b802b781/68747470733a2f2f706f7365722e707567782e6f72672f77696b696d656469612f74657374696e672d6163636573732d777261707065722f762f737461626c652e737667)](https://packagist.org/packages/wikimedia/testing-access-wrapper) [![License](https://camo.githubusercontent.com/b2e95a754957c5099accf23b7e08692e59b3145c64af68baf8750fbeb1ef4fbf/68747470733a2f2f706f7365722e707567782e6f72672f77696b696d656469612f74657374696e672d6163636573732d777261707065722f6c6963656e73652e737667)](https://packagist.org/packages/wikimedia/testing-access-wrapper)

Wikimedia Testing Access Wrapper
================================

[](#wikimedia-testing-access-wrapper)

Testing Access Wrapper is a simple helper for writing unit tests which provides convenient shortcuts for using reflection to access non-public properties/methods.

The code was originally part of MediaWiki. See composer.json for a list of authors.

Usage
-----

[](#usage)

```
use Wikimedia\TestingAccessWrapper;

class NonPublic {
	protected $prop;
	protected const CONSTANT = 4;
	protected function func() {}
	protected static function staticFunc() {}
}

class NonPublicCtor {
	protected function __construct() {}
}

$object = new NonPublic();
// or:
// $object = TestingAccessWrapper::construct( NonPublicCtor::class );

$wrapper = TestingAccessWrapper::newFromObject( $object );
$classWrapper = TestingAccessWrapper::newFromClass( NonPublic::class );

$wrapper->prop = 'foo';
$wrapper->func();
$classWrapper->staticFunc();

$value = TestingAccessWrapper::constant( NonPublic::class, 'CONSTANT' );
```

Running tests
-------------

[](#running-tests)

```
composer install
composer test

```

---

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance78

Regular maintenance activity

Popularity45

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~1040 days

Total

4

Last Release

196d ago

Major Versions

1.0.0 → 2.0.02020-11-27

2.0.0 → 3.0.02023-11-28

3.0.0 → 4.0.02025-11-03

PHP version history (4 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;=7.2.9

3.0.0PHP &gt;=7.4

4.0.0PHP &gt;=8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

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

---

Top Contributors

[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (13 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (10 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (5 commits)")[![cscott](https://avatars.githubusercontent.com/u/156080?v=4)](https://github.com/cscott "cscott (4 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (4 commits)")[![xSavitar](https://avatars.githubusercontent.com/u/4872561?v=4)](https://github.com/xSavitar "xSavitar (3 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (3 commits)")[![DannyS712](https://avatars.githubusercontent.com/u/46829944?v=4)](https://github.com/DannyS712 "DannyS712 (2 commits)")[![MaxSem](https://avatars.githubusercontent.com/u/1260606?v=4)](https://github.com/MaxSem "MaxSem (1 commits)")[![tgr](https://avatars.githubusercontent.com/u/145412?v=4)](https://github.com/tgr "tgr (1 commits)")[![Daimona](https://avatars.githubusercontent.com/u/38216014?v=4)](https://github.com/Daimona "Daimona (1 commits)")[![Ammarpad](https://avatars.githubusercontent.com/u/45658045?v=4)](https://github.com/Ammarpad "Ammarpad (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wikimedia-testing-access-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/wikimedia-testing-access-wrapper/health.svg)](https://phpackages.com/packages/wikimedia-testing-access-wrapper)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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