PHPackages                             i3bepb/reflection-for-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. i3bepb/reflection-for-test

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

i3bepb/reflection-for-test
==========================

Trait adding access method through reflection for tests

1.0.3(1y ago)05651MITPHPPHP ^7.0 || ^8.0

Since Feb 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/i3bepb/reflection-for-test)[ Packagist](https://packagist.org/packages/i3bepb/reflection-for-test)[ RSS](/packages/i3bepb-reflection-for-test/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (1)

Reflection for test
===================

[](#reflection-for-test)

[![Latest Stable Version](https://camo.githubusercontent.com/778acce41b2d771f957c21f02cfc9825ff7e3f03151e74aad37dbf256da66e01/68747470733a2f2f706f7365722e707567782e6f72672f6933626570622f7265666c656374696f6e2d666f722d746573742f76)](https://packagist.org/packages/i3bepb/reflection-for-test)[![Total Downloads](https://camo.githubusercontent.com/430e63c7e54c1591208caa1dd4775cb00e47e7152e0736044ff7f2e733dcfd07/68747470733a2f2f706f7365722e707567782e6f72672f6933626570622f7265666c656374696f6e2d666f722d746573742f646f776e6c6f616473)](https://packagist.org/packages/i3bepb/reflection-for-test)

Trait adding access method through reflection for tests

Install
-------

[](#install)

```
composer require --dev i3bepb/reflection-for-test

```

How to use
----------

[](#how-to-use)

When need call private method and check result in test, you can use trait **AccessToMethod**. Example:

```

use I3bepb\ReflectionForTest\AccessToMethod;
use PHPUnit\Framework\TestCase;

class AnyTest extends TestCase
{
    use AccessToMethod;

    /**
     * Any test.
     *
     * @test
     *
     * @throws \ReflectionException
     */
    public function any_test()
    {
        $object = new ClassWithPrivateMethod();

        // In $resultPrivateMethod result after call private method
        $resultPrivateMethod = $this->privateMethodWithParameters($object, 'privateMethod', ['abc', 123]);

        // Any test...
    }
```

Tests through docker
--------------------

[](#tests-through-docker)

Download image

```
docker pull php:7.0.33-cli-alpine

```

Run container with volume into

```
docker run --rm -it -v $(pwd):/app -w /app php:7.0.33-cli-alpine sh

```

Into container get composer -

```
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

```

Now exist file **composer.phar** and you can download dependencies

```
php composer.phar install

```

Run tests

```
./vendor/bin/phpunit

```

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance45

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Total

4

Last Release

457d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57417a68f3fb9636dcb2e98d271ee278b29ca8f329c9e4070193602d2f4df7c0?d=identicon)[i3bepb](/maintainers/i3bepb)

---

Top Contributors

[![i3bepb](https://avatars.githubusercontent.com/u/1553797?v=4)](https://github.com/i3bepb "i3bepb (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/i3bepb-reflection-for-test/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M678](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/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.0k](/packages/orchestra-testbench)

PHPackages © 2026

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