Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 216.73.216.116
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
3 /
mockery /
mockery /
docs /
reference /
Delete
Unzip
Name
Size
Permission
Date
Action
alternative_should_receive_syntax.rst
2.33
KB
-rw-r--r--
2018-10-02 09:00
argument_validation.rst
9.83
KB
-rw-r--r--
2018-10-02 09:00
creating_test_doubles.rst
13.78
KB
-rw-r--r--
2018-10-02 09:00
demeter_chains.rst
1.6
KB
-rw-r--r--
2018-10-02 09:00
expectations.rst
13.41
KB
-rw-r--r--
2018-10-02 09:00
final_methods_classes.rst
1.29
KB
-rw-r--r--
2018-10-02 09:00
index.rst
400
B
-rw-r--r--
2018-10-02 09:00
instance_mocking.rst
805
B
-rw-r--r--
2018-10-02 09:00
magic_methods.rst
687
B
-rw-r--r--
2018-10-02 09:00
map.rst.inc
550
B
-rw-r--r--
2018-10-02 09:00
partial_mocks.rst
4.19
KB
-rw-r--r--
2018-10-02 09:00
pass_by_reference_behaviours.rst
4.22
KB
-rw-r--r--
2018-10-02 09:00
phpunit_integration.rst
4.89
KB
-rw-r--r--
2018-10-02 09:00
protected_methods.rst
668
B
-rw-r--r--
2018-10-02 09:00
public_properties.rst
821
B
-rw-r--r--
2018-10-02 09:00
public_static_properties.rst
701
B
-rw-r--r--
2018-10-02 09:00
spies.rst
4.63
KB
-rw-r--r--
2018-10-02 09:00
Save
Rename
.. index:: single: Mocking; Demeter Chains Mocking Demeter Chains And Fluent Interfaces ============================================ Both of these terms refer to the growing practice of invoking statements similar to: .. code-block:: php $object->foo()->bar()->zebra()->alpha()->selfDestruct(); The long chain of method calls isn't necessarily a bad thing, assuming they each link back to a local object the calling class knows. As a fun example, Mockery's long chains (after the first ``shouldReceive()`` method) all call to the same instance of ``\Mockery\Expectation``. However, sometimes this is not the case and the chain is constantly crossing object boundaries. In either case, mocking such a chain can be a horrible task. To make it easier Mockery supports demeter chain mocking. Essentially, we shortcut through the chain and return a defined value from the final call. For example, let's assume ``selfDestruct()`` returns the string "Ten!" to $object (an instance of ``CaptainsConsole``). Here's how we could mock it. .. code-block:: php $mock = \Mockery::mock('CaptainsConsole'); $mock->shouldReceive('foo->bar->zebra->alpha->selfDestruct')->andReturn('Ten!'); The above expectation can follow any previously seen format or expectation, except that the method name is simply the string of all expected chain calls separated by ``->``. Mockery will automatically setup the chain of expected calls with its final return values, regardless of whatever intermediary object might be used in the real implementation. Arguments to all members of the chain (except the final call) are ignored in this process.