PHPUnit MockAnnotations

2.0.0 2017-04-14 15:44 UTC

This package is not auto-updated.

Last update: 2024-06-14 02:36:24 UTC


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 via composer

composer require eltrino/phpunit-mockannotations

or add it to your composer.json file.


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()
    public function testProcess()
        $generator = new Generator($this->config);
        $result = $generator->process();

###License MIT


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 if you wish to be a part of the project.