Blame | Letzte Änderung | Log anzeigen | RSS feed
.. index::single: Mocking; InstanceInstance 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 realclass with an instance mock (similar to an alias mock), as with mocking publicmethods. The alias will import its expectations from the original mock ofthat type (note that the original is never verified and should be ignoredafter its expectations are setup). This lets you intercept instantiation whereyou can't simply inject a replacement object.As before, this does not prevent a require statement from including the realclass and triggering a fatal PHP error. It's intended for use whereautoloading is the primary class loading mechanism.