-
Notifications
You must be signed in to change notification settings - Fork 117
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
Change of behavior when calling parent methods statically #280
Comments
I'm experiencing the same issue. I have a class mocking a static method, but when called internally it doesn't call the mocked one but instead it makes the actual call. Any idea or workaround? |
here's a workaround patch, it's not ideal because it removes anything you might want from the Phake stubber callback, but it's what we've been doing for the last 3 years with success
|
Thanks @theilig, this behavior was changed in v2.2.1 and instantly broke the test my team had in their repo. Changing this will imply making changes to the vendor dependencies which I"m not a big fan of. But I guess we don't have other options. Thanks. |
agreed, for now we have our own forked version which isn't great. However
we have hundreds of tests that rely on this behavior.
…On Mon, Apr 17, 2023 at 3:09 PM Pablo Molina ***@***.***> wrote:
Thanks @theilig <https://github.com/theilig>, this behavior was changed
in v2.2.1 and instantly broke the test my team had in their repo. Changing
this will imply making changes to the vendor dependencies which I"m not a
big fan of. But I guess we don't have other options. Thanks.
—
Reply to this email directly, view it on GitHub
<#280 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKGVXQSQ57SK55PH5RBZKCLXBW5QDANCNFSM4JKC6CVQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'll have a look at if/how we can configure that |
Noticed this while trying to upgrade from 2.1.1 to 3.1.6
in 2.1.1 the created Phake class called directly into the parent, which kept the late static binding associated to the mock, resulting in the static::b call correctly being mocked as well (returning 'there')
however in 3.1.6 the Phake class calles ParentDelegateCallback->__invoke()
which calls invokeArgs, which calls reflectionMethod with a null context. This means the late static binding will no longer be the mock, but instead be the SUT. static::b then does not hit the mock (returning 'here')
I suspect passing the mock as the context would fix it rather than null, but without looking it doesn't seem like an easy thing to do
The text was updated successfully, but these errors were encountered: