expects( new \PHPUnit_Framework_MockObject_Matcher_InvokedCount(1) )->method( $expectedMethod ); $builder = call_user_func_array([$builder, 'with'], $expectedParams); $builder->will(new \PHPUnit_Framework_MockObject_Stub_Return($proxiedResult)); return call_user_func_array([$object, $method], $params); } }