PATH:
home
/
lab2454c
/
healthvalidate.com
/
vendor
/
mockery
/
mockery
/
docs
/
reference
.. index:: single: Mocking; Protected Methods Mocking Protected Methods ========================= By default, Mockery does not allow mocking protected methods. We do not recommend mocking protected methods, but there are cases when there is no other solution. For those cases we have the ``shouldAllowMockingProtectedMethods()`` method. It instructs Mockery to specifically allow mocking of protected methods, for that one class only: .. code-block:: php class MyClass { protected function foo() { } } $mock = \Mockery::mock('MyClass') ->shouldAllowMockingProtectedMethods(); $mock->shouldReceive('foo');
[-] map.rst.inc
[edit]
[-] partial_mocks.rst
[edit]
[-] public_static_properties.rst
[edit]
[-] spies.rst
[edit]
[+]
..
[-] expectations.rst
[edit]
[-] creating_test_doubles.rst
[edit]
[-] phpunit_integration.rst
[edit]
[-] argument_validation.rst
[edit]
[-] final_methods_classes.rst
[edit]
[-] instance_mocking.rst
[edit]
[-] demeter_chains.rst
[edit]
[-] index.rst
[edit]
[-] alternative_should_receive_syntax.rst
[edit]
[-] magic_methods.rst
[edit]
[-] pass_by_reference_behaviours.rst
[edit]
[-] protected_methods.rst
[edit]
[-] public_properties.rst
[edit]