public_properties.rst 821 B

1234567891011121314151617181920
  1. .. index::
  2. single: Mocking; Public Properties
  3. Mocking Public Properties
  4. =========================
  5. Mockery allows us to mock properties in several ways. One way is that we can set
  6. a public property and its value on any mock object. The second is that we can
  7. use the expectation methods ``set()`` and ``andSet()`` to set property values if
  8. that expectation is ever met.
  9. You can read more about :ref:`expectations-setting-public-properties`.
  10. .. note::
  11. In general, Mockery does not support mocking any magic methods since these
  12. are generally not considered a public API (and besides it is a bit difficult
  13. to differentiate them when you badly need them for mocking!). So please mock
  14. virtual properties (those relying on ``__get()`` and ``__set()``) as if they
  15. were actually declared on the class.