redhead/mockyll

Mocking library for PHP (>= 5.4).

dev-master 2013-09-15 20:12 UTC

This package is not auto-updated.

Last update: 2020-09-13 19:37:54 UTC


README

Nice and simple mocking library for PHP based on GMock for Groovy.

It offers:

  • simple usage
  • no complicated setup
  • class and interface mocking based on inheritance
  • partial mocks

Install

Install the library using composer:

$ composer require redhead/mockyll:@dev

That's it!

Simple usage

$mockController = new Mockyll\MockController;

$myClassMock = $mockController->mock('MyClass');
$myClassMock->greet('world')->returns('hello world!');

$mockController->play(function() use ($myClassMock) {
  $myClassMock->greet('world'); // == 'hello world!'
}