NAME
Test::Magpie::Mock - A mock object
DESCRIPTION
Mock objects are the objects you pass around as if they were real objects. They do not have a defined API; any method call is valid. A mock on its own is in record mode - method calls and arguments will be saved. You can switch temporarily to stub and verification mode with when
and verify
in Test::Magpie, respectively.
ATTRIBUTES
class
This attribute is the name of the class that the object is pretending to be blessed into. This is only needed if you call ref()
on the object and want it to return a particular type.
stubs
This attribute is internal, and not publically accessible.
Returns a map of method name to stub array references. Stubs are matched against invocation arguments to determine which stub to dispatch to.
invocations
This attribute is internal, and not publically accessible.
Returns an array reference of all method invocations on this mock.
METHODS
isa $class
Forced to return true for any package
does $role
Forced to return true for any role
ref
Returns the value of the object's class
attribute. This also works if you call ref()
as a function instead of a method.
AUTHORS
Oliver Charles <oliver.g.charles@googlemail.com>
Steven Lee <stevenwh.lee@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Oliver Charles.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.