2017 © Pedro Peláez
 

library phpunit-mockannotations

PHPUnit MockAnnotations

image

eltrino/phpunit-mockannotations

PHPUnit MockAnnotations

  • Friday, April 14, 2017
  • by odi-um
  • Repository
  • 13 Watchers
  • 4 Stars
  • 7,397 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

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., (*1)

Installation

Installation via composer, (*2)

composer require eltrino/phpunit-mockannotations

or add it to your composer.json file., (*3)

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, (*4)

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 if you wish to be a part of the project., (*5)

The Versions

14/04 2017

dev-master

9999999-dev

PHPUnit MockAnnotations

  Sources   Download

MIT

The Development Requires

by Ruslan Voitenko

14/04 2017

2.0.0

2.0.0.0

PHPUnit MockAnnotations

  Sources   Download

MIT

The Development Requires

by Ruslan Voitenko

15/09 2015

1.0.0

1.0.0.0

PHPUnit MockAnnotations

  Sources   Download

MIT

The Development Requires

by Ruslan Voitenko