Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call parent __callStatic method #699

Closed
wants to merge 1 commit into from

Conversation

imaben
Copy link

@imaben imaben commented Feb 16, 2017

eg.

class MyBaseClass {
    public static function __callStatic($name, $args)
    {
        if ($name == 'foo1') {
            // todo
        }
    }
}
$mock = Mockery::mock('MyNameClass', MyBaseClass::class);
MyNameClass::foo1();

So, it's will throw \BadMethodCallException

@davedevelopment
Copy link
Collaborator

I can't think if there will be any wtfs with this change. The problem is, we allow people to set up expectations in a weird way, that is using the returned mock object to set up stubs and expectations for static calls, e.g.

 $mock = Mockery::namedMock('MyNameClass', MyBaseClass::class);
 $mock->allows()->foo1()->andReturns('dave');

This PR is effectively going to remove that checking of calls have been set up properly. Perhaps the makePartial functionality should also apply to static calls?

@imaben imaben closed this Mar 10, 2017
@davedevelopment
Copy link
Collaborator

Just to be clear, I wasn't saying "no" to this PR, I was just opening up some concerns for discussion...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants