Skip to content

Mocking public properties gives undefined property error #77

@olivernybroe

Description

@olivernybroe

When creating a mock and setting a property on the mock, which is the recommended way for mocking public properties, it gives an undefined property error.

$user = Mockery::mock(User::class);
$user->name = "Oliver";
Access to an undefined property Mockery\MockInterface::$name. 

current workaround is to just add the following ignore error

        - '#Access to an undefined property Mockery\\MockInterface::\$.*\.#'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions