Feature/autoload mocker with filters #762

merged 2 commits into from Dec 21, 2012


None yet

2 participants


Fix for original #755

Same stats:
Code Complexity: 1.75
Code Coverage: 100%


If there's a single commit they throw the long description into the pull request description. There were two commits so that didn't happen. You can look at the last commit for a good explanation of what/why changed.

@blainesch blainesch Fix bug with how results are rendered.
The issue was we were rendering results BEFORE the filter, passing it in and returning it. This is bad since the results may modify the existing class and being a filter you may choose never to get that far in  your chain.

The fix is a bit complex but covers my bases.

You create a class 'Mock' which extends the class you wish to mock, this will be directly accessed by the consumer, but it doesnt interact with itself, it sends all its responsibilities to another class we create 'MockDelegate'.

MockDelegate which, if called from the Mock class will pass it along to the real mocked class, or if called from the extended class, will submit it back out through the client Mock class. Now all methods are filtered.

A known issue is not something I can really fix.
~~~ php
class Foo {
	public static function doSomething() {
		return self::doSomethingElse();
	public static function doSomethingElse() {
		return false;
If you are Mocking this class the `doSomething` methods NEVER goes to the extending 'MockDelegate' to be re-filtered so this method would NOT be filtered even if you have set a filter for this method.
@nateabele nateabele merged commit dda0ddf into UnionOfRAD:dev Dec 21, 2012

1 check passed

default The Travis build passed
@blainesch blainesch deleted the unknown repository branch Jan 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment