Function Mocker stop wrapping things 02

A more functional solution to Function Mocker indiscriminate input wrapping.

Update code

I’ve update function-mocker and pushed its latest version to ship with the FunctionMocker::init method.
This will allow for more selective and less intrusive wrapping to happen while still allowing a lazy approach using the FunctionMocker::setUp method.
An abstract from the updated README:

By default any library in the vendor folder will be excluded from the input wrapping and everything else will be included. If files in any of the vendor sub-folders need to be wrapped for testing purposes, or a folder that’s not in the vendor folder needs to be excluded, then an array of options can be passed to the init method like

<?php // This is global bootstrap for autoloading use tad\FunctionMocker\FunctionMocker; require_once dirname( __FILE__ ) . '/../vendor/autoload.php'; FunctionMocker::init([ 'include' => ['vendor/package', 'vendor/another'], 'exclude' => ['libs/folder', 'src/another-folder'] ]); 

If the call to the init method is omitted then it will be called on the first call to the setUp method in the tests.


Time to put the library under some more work and wait for the next bug/issue to happen.

I appreciate your input