404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.129.211.228: ~ $
.. 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.33 KB 0644
argument_validation.rst File 10.49 KB 0644
creating_test_doubles.rst File 14.12 KB 0644
demeter_chains.rst File 1.6 KB 0644
expectations.rst File 15.57 KB 0644
final_methods_classes.rst File 1.32 KB 0644
index.rst File 400 B 0644
instance_mocking.rst File 805 B 0644
magic_methods.rst File 687 B 0644
map.rst.inc File 550 B 0644
partial_mocks.rst File 4.19 KB 0644
pass_by_reference_behaviours.rst File 4.22 KB 0644
phpunit_integration.rst File 4.74 KB 0644
protected_methods.rst File 668 B 0644
public_properties.rst File 821 B 0644
public_static_properties.rst File 701 B 0644
spies.rst File 4.63 KB 0644