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

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

apiframework/test
=================

Test writing utilities.

0.0.1(11y ago)023BSD-3-ClausePHPPHP &gt;=5.3.0

Since Jul 7Pushed 11y ago1 watchersCompare

[ Source](https://github.com/apiframework/Test)[ Packagist](https://packagist.org/packages/apiframework/test)[ Docs](https://github.com/apiframework/Test)[ RSS](/packages/apiframework-test/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Test
====

[](#test)

[![Build Status](https://camo.githubusercontent.com/a3c9df0b1c9ae03361e244237625771c81496ed4c021af65780768222534d6ed/68747470733a2f2f6170692e7472617669732d63692e6f72672f6170696672616d65776f726b2f546573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/apiframework/Test)

Test writing utilities

### Apiframework\\Test\\ProtectedReflection

[](#apiframeworktestprotectedreflection)

Allows easy testing for protected methods and properties.

### invokeMethod - Execute a protected method

[](#invokemethod---execute-a-protected-method)

```
class Robot
{

    protected $cache = [];

    public function addToCache($key, $value) {
        $this->cache[$key] = $value;
    }

    protected function helloTwo($one, $two)
    {
        return "hello $one $two";
    }

}

$robot = new Robot;

$protected = (new Apiframework\Test\ProtectedReflectionFactory)->build($robot);

// Accepts an array of arguments equal to the amount of arguments of the method
$helloTwo = $protected->invokeMethod("helloTwo", ['varOne', 'varTwo']);

var_dump($helloTwo);
```

### Output

[](#output)

```
string(19) "hello varOne varTwo"

```

### getProperty - get a protected property of the class

[](#getproperty---get-a-protected-property-of-the-class)

```
$protected->invokeMethod("addToCache", ['david', 'bowie']);

$cache = $protected->getProperty("cache");

var_dump($cache);
```

### Output

[](#output-1)

```
array(1) {
  'david' =>
  string(5) "bowie"
}

```

### setProperty - set a protected property

[](#setproperty---set-a-protected-property)

```
$protected->setProperty("cache", ['fab' => 'four']);

$cache = $protected->getProperty("cache");

var_dump($cache);
```

### Output

[](#output-2)

```
array(1) {
  'fab' =>
  string(4) "four"
}

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

4333d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8084172?v=4)[Hone Watson](/maintainers/apiframework)[@apiframework](https://github.com/apiframework)

---

Top Contributors

[![honewatson](https://avatars.githubusercontent.com/u/440474?v=4)](https://github.com/honewatson "honewatson (8 commits)")[![apiframework](https://avatars.githubusercontent.com/u/8084172?v=4)](https://github.com/apiframework "apiframework (1 commits)")

---

Tags

test

### Embed Badge

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

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

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[hamcrest/hamcrest-php

This is the PHP port of Hamcrest Matchers

7.1k484.1M109](/packages/hamcrest-hamcrest-php)[nelmio/alice

Expressive fixtures generator

2.5k43.4M133](/packages/nelmio-alice)[zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

78311.9M97](/packages/zenstruck-foundry)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

36918.1M98](/packages/php-mock-php-mock)[brain/monkey

Mocking utility for PHP functions and WordPress plugin API

33412.5M350](/packages/brain-monkey)

PHPackages © 2026

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