PHPackages                             maks3w/phpunit-methods-trait - 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. maks3w/phpunit-methods-trait

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

maks3w/phpunit-methods-trait
============================

Provide PHPUnit method signatures as traits for IDE autocomplete

v9.5.0(5y ago)11.3k1[1 PRs](https://github.com/Maks3w/PhpUnitMethodsTrait/pulls)1BSD-2-ClausePHPPHP &gt;= 7.4

Since Jun 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Maks3w/PhpUnitMethodsTrait)[ Packagist](https://packagist.org/packages/maks3w/phpunit-methods-trait)[ Docs](https://github.com/Maks3w/PhpUnitMethodsTrait)[ RSS](/packages/maks3w-phpunit-methods-trait/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (13)Used By (1)

PHPUnit methods trait
=====================

[](#phpunit-methods-trait)

Provide a PHP Trait with methods present in PHPUnit Test Framework and expected to be implemented by TestCase.

This is useful when traits are used for test reuse, and it's necessary to access to PHPUnit\\Framework\\TestCase methods from the trait.

Installing via Composer
-----------------------

[](#installing-via-composer)

You can use [Composer](https://getcomposer.org) .

```
composer require maks3w/phpunit-methods-trait
```

Usage
-----

[](#usage)

Example of use in a trait

```
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;

trait FooTrait {
  use \Maks3w\PhpUnitMethodsTrait\Framework\TestCaseTrait;

  public function testFoo() {
    $mockFoo = $this->getMock('Foo');
    $mockFoo->expects(TestCase::any())
      ->method('getFoo')
      ->willReturn(true)
    ;

    Assert::assertTrue($mockFoo->getFoo());
  }
}
```

FAQ
---

[](#faq)

 Q: Assertion methods are not recognized. Why?  A: Assertion methods like `assertTrue` are static methods present in `PHPUnit\\Framework\\Assert` just access them using static method call `PHPUnit\\Framework\\Assert::assertTrue(...)` License
-------

[](#license)

Code licensed under BSD 2 clauses terms &amp; conditions.

See [LICENSE.txt](LICENSE.txt) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% 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 ~227 days

Recently: every ~242 days

Total

10

Last Release

1946d ago

Major Versions

v4.6.0 → v5.3.02016-04-16

v4.8.26 → v5.7.02018-03-18

v5.7.0 → v6.5.02018-03-18

v6.5.0 → v7.1.02018-05-25

v7.1.0 → v9.0.02020-02-17

PHP version history (5 changes)v4.6.0PHP &gt;= 5.4

v5.7.0PHP &gt;= 5.6

v6.5.0PHP &gt;= 7.0

v7.1.0PHP &gt;= 7.1

v9.5.0PHP &gt;= 7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/19fdc97ccc21fe2689824d70ab378dfd2364433eeaca3e9b321beeb68eb79106?d=identicon)[Maks3w](/maintainers/Maks3w)

---

Top Contributors

[![Maks3w](https://avatars.githubusercontent.com/u/1301698?v=4)](https://github.com/Maks3w "Maks3w (37 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

hacktoberfestphpunittestcasetestingtraitphpunitautocomplete

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/maks3w-phpunit-methods-trait/health.svg)

```
[![Health](https://phpackages.com/badges/maks3w-phpunit-methods-trait/health.svg)](https://phpackages.com/packages/maks3w-phpunit-methods-trait)
```

###  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)
