Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 812 Bytes

11-MOCKING-PUBLIC-PROPERTIES.md

File metadata and controls

17 lines (11 loc) · 812 Bytes

Mocking Public Properties

Mockery allows you to mock properties in several ways. The simplest is that you can simply set a public property and value on any mock object. The second is that you can use the expectation methods set() and andSet() to set property values if that expectation is ever met.

You should note that, in general, Mockery does not support mocking any magic methods since these are generally not considered a public API (and besides they are a PITA to differentiate when you badly need them for mocking!). So please mock virtual properties (those relying on __get() and __set()) as if they were actually declared on the class.

← Previous | Contents | Next →