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

Warn when calling Phockito::verify($obj)->staticMethodName() #8

Open
TysonAndre opened this issue Oct 28, 2022 · 0 comments
Open

Warn when calling Phockito::verify($obj)->staticMethodName() #8

TysonAndre opened this issue Oct 28, 2022 · 0 comments

Comments

@TysonAndre
Copy link

TysonAndre commented Oct 28, 2022

This will always have 0 calls on the instance if the method is a static method, in the generated code.

Use Phockito::when($obj->staticMethodName()) to create a mock (with the call inside when(....))

PHP allows calling static methods on the instance.

Phockito::when($obj->staticMethodName())... is mocking the static method instead and calls will be recorded as 'instance' => "::$className"

__phockito_setMethod should check if the method of the class is static (cache the result)

And the verification should perform the same check

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

No branches or pull requests

1 participant