Access private functions and properties of PHP classes. Primarily used to muck with things under test.
Via Composer
$ composer require kidfund/monkey-patcher
Note: If you are using this, you may have a broken pattern somewhere. Either in your main code or in test-land. But, sometimes you need it!
Add the trait to your test
class MonkeyPatcherUnitTest extends PHPUnit_Framework_TestCase
{
use MonkeyPatcher;
$this->invokeMethod($object, 'do', ['something']);
$this->setProperty($object, 'msg', 'hello');
$this->getProperty($object, 'msg');
$ ./vendor/bin/phpunit
Please see CONTRIBUTING and CONDUCT for details.
The MIT License (MIT). Please see License File for more information.