Function Mocker stop wrapping things 02
December 23, 2014
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
vendorfolder will be excluded from the input wrapping and everything else will be included. If files in any of thevendorsub-folders need to be wrapped for testing purposes, or a folder that's not in thevendorfolder needs to be excluded, then an array of options can be passed to theinitmethod 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
initmethod is omitted then it will be called on the first call to thesetUpmethod in the tests.
Next
Time to put the library under some more work and wait for the next bug/issue to happen.