Function mocking with Patchwork 08

Where I find myself committing a stupid error and thinking out loud about the function mocker.

My mistake

The following test commits asserts a mocking crime is committed

/**
 * @test
 * it should return an instance mock object when mocking an instance method
 */
public function it_should_return_an_instance_mock_object_when_mocking_an_instance_method() {
    $sut = FunctionMocker::mock( __NAMESPACE__ . '\SomeClass::instanceMethod' );
    $this->assertInstanceOf( 'tad\FunctionMocker\InstanceMock', $sut );
}

and that’s violating the mocking principle that the object returned by the mocking engine should be of the same type of the mocked one. The following test will, in fact, fail

/**
 * @test
 * it should return an instance of the mocked class when mocking an instance method
 */
public function it_should_return_an_instance_of_the_mocked_class_when_mocking_an_instance_method() {
    $sut = FunctionMocker::mock( __NAMESPACE__ . '\SomeClass::instanceMethod' );
    $this->assertInstanceOf( __NAMESPACE__ . '\SomeClass', $sut );
}

Kind of a roadblock

To keep things uniform I’ve got to present a mock object generated by PHPUnit, get hold of its invocation matcher and forward any call that’s made to it for my target interface to t another object that I have to attach to the mock one some way.
Tricky…

I appreciate your input