PHPackages                             eltrino/phpunit-mockannotations - 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. eltrino/phpunit-mockannotations

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

eltrino/phpunit-mockannotations
===============================

PHPUnit MockAnnotations

2.0.0(9y ago)48.0k10MITPHPCI failing

Since Sep 15Pushed 9y ago13 watchersCompare

[ Source](https://github.com/eltrino/PHPUnit_MockAnnotations)[ Packagist](https://packagist.org/packages/eltrino/phpunit-mockannotations)[ RSS](/packages/eltrino-phpunit-mockannotations/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (3)Used By (10)

PHPUnit MockAnnotations
=======================

[](#phpunit-mockannotations)

This provide a simplified way to create native PHPUnit mocks in test cases using annotations in properties doc block. Currently creation of mocks for abstract classes is not supported.

\###Installation

Installation via composer

```
composer require eltrino/phpunit-mockannotations

```

or add it to your composer.json file.

### Usage

[](#usage)

```
namespace Lib\Tests;

use Lib\Generator;
use Lib\ConfigInterface;
use Eltrino\PHPUnit\MockAnnotations\MockAnnotations;
use PHPUnit\Framework\TestCase;

class GeneratorTest extends TestCase
{
    /**
     * @Mock Lib\ConfigInterface
     */
    private $config;

    protected function setUp()
    {
        MockAnnotations::init($this);
    }

    public function testProcess()
    {
        $config
            ->expects($this->once())
            ->method('getOption')
            ->with($this->equalTo('title'))
            ->will($this->returnValue('option_value'));

        $generator = new Generator($this->config);
        $result = $generator->process();

        $this->assertIsNotNull($result);
    }
}
```

\###License MIT

Contributing
------------

[](#contributing)

We welcome all kinds of contributions in the form of bug reporting, patches submitting, feature requests or documentation enhancement. Please refer to our [guidelines for contributing](https://github.com/eltrino/PHPUnit_MockAnnotations/blob/master/Contributing.md) if you wish to be a part of the project.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~577 days

Total

2

Last Release

3357d ago

Major Versions

1.0.0 → 2.0.02017-04-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7554f5c0829e95fe802ee2c4548cca78b23c955b1500e45e9564892b2a1a140?d=identicon)[odi-um](/maintainers/odi-um)

![](https://www.gravatar.com/avatar/7ab3895f08d3ecdbfd6e2b59abcfeaec44f06e51a49d49ca36459406f4b30395?d=identicon)[psw1986](/maintainers/psw1986)

---

Top Contributors

[![psw1986](https://avatars.githubusercontent.com/u/1023128?v=4)](https://github.com/psw1986 "psw1986 (9 commits)")[![odi-um](https://avatars.githubusercontent.com/u/1123504?v=4)](https://github.com/odi-um "odi-um (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eltrino-phpunit-mockannotations/health.svg)

```
[![Health](https://phpackages.com/badges/eltrino-phpunit-mockannotations/health.svg)](https://phpackages.com/packages/eltrino-phpunit-mockannotations)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M340](/packages/dms-phpunit-arraysubset-asserts)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8219.1M69](/packages/orchestra-workbench)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)[kunicmarko/graphql-test

GraphQL Test Cases

1359.0k](/packages/kunicmarko-graphql-test)

PHPackages © 2026

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