404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.145.54.136: ~ $
.. 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');


Filemanager

Name Type Size Permission Actions
alternative_should_receive_syntax.rst File 2.41 KB 0644
argument_validation.rst File 10.82 KB 0644
creating_test_doubles.rst File 14.55 KB 0644
demeter_chains.rst File 1.64 KB 0644
expectations.rst File 16.09 KB 0644
final_methods_classes.rst File 1.35 KB 0644
index.rst File 422 B 0644
instance_mocking.rst File 827 B 0644
magic_methods.rst File 703 B 0644
map.rst.inc File 564 B 0644
partial_mocks.rst File 4.29 KB 0644
pass_by_reference_behaviours.rst File 4.35 KB 0644
phpunit_integration.rst File 4.88 KB 0644
protected_methods.rst File 694 B 0644
public_properties.rst File 841 B 0644
public_static_properties.rst File 716 B 0644
spies.rst File 4.78 KB 0644