Skip to content

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

Open
@TysonAndre

Description

@TysonAndre

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions