Blame | Letzte Änderung | Log anzeigen | RSS feed
.. index::single: Mockery; ExceptionsMockery Exceptions==================Mockery throws three types of exceptions when it cannot verify a mock object.#. ``\Mockery\Exception\InvalidCountException``#. ``\Mockery\Exception\InvalidOrderException``#. ``\Mockery\Exception\NoMatchingExpectationException``You can capture any of these exceptions in a try...catch block to query themfor specific information which is also passed along in the exception messagebut is provided separately from getters should they be useful when logging orreformatting output.\Mockery\Exception\InvalidCountException----------------------------------------The exception class is used when a method is called too many (or too few)times and offers the following methods:* ``getMock()`` - return actual mock object* ``getMockName()`` - return the name of the mock object* ``getMethodName()`` - return the name of the method the failing expectationis attached to* ``getExpectedCount()`` - return expected calls* ``getExpectedCountComparative()`` - returns a string, e.g. ``<=`` used tocompare to actual count* ``getActualCount()`` - return actual calls made with given argumentconstraints\Mockery\Exception\InvalidOrderException----------------------------------------The exception class is used when a method is called outside the expected orderset using the ``ordered()`` and ``globally()`` expectation modifiers. Itoffers the following methods:* ``getMock()`` - return actual mock object* ``getMockName()`` - return the name of the mock object* ``getMethodName()`` - return the name of the method the failing expectationis attached to* ``getExpectedOrder()`` - returns an integer represented the expected indexfor which this call was expected* ``getActualOrder()`` - return the actual index at which this method calloccurred.\Mockery\Exception\NoMatchingExpectationException-------------------------------------------------The exception class is used when a method call does not match any knownexpectation. All expectations are uniquely identified in a mock object by themethod name and the list of expected arguments. You can disable this exceptionand opt for returning NULL from all unexpected method calls by using theearlier mentioned shouldIgnoreMissing() behaviour modifier. This exceptionclass offers the following methods:* ``getMock()`` - return actual mock object* ``getMockName()`` - return the name of the mock object* ``getMethodName()`` - return the name of the method the failing expectationis attached to* ``getActualArguments()`` - return actual arguments used to search for amatching expectation