feedtailor/mocking-method-invoker

Any methods invoker for Mock object.

0.1.0 2014-08-05 01:33 UTC

This package is not auto-updated.

Last update: 2024-04-23 05:26:50 UTC


README

Any methods invoker for Mock object.

Build Status

Install

Add feedtailor/mocking-method-invoker as a dependency in your project's composer.json file.

{
  "require": {
    "feedtailor/mocking-method-invoker": "dev-master"
  }
}

Example

use Feedtailor\Mocking\MethodInvoker;

class ExampleClass
{
    protected function add($a, $b)
    {
        return $a + $b;
    }
}

$obj = new ExampleClass();

$result = MethodInvoker::create($obj)->invoke("getFoo", array(40, 2)) // got 42.

Methods

$invoker = new MethodInvoker($obj);

$invoker = MethodInvoker::create($obj);

Create a new MethodInvoker instance.

$invoker->invoke($name, $args);

invoke the $name method with $args array arguments.

License

Licensed under the MIT License.