table of contents
Test::Magpie::Inspect(3) | User Contributed Perl Documentation | Test::Magpie::Inspect(3) |
NAME¶
Test::Magpie::Inspect - Inspect method invocations on mock objects
SYNOPSIS¶
my $mock = mock; $mock->something({ deep => { structure => [] }}; my $invocation = inspect($mock)->something(anything); ok(defined $invocation, 'something was called'); is_deeply(($invocation->arguments)[0], { deep => { structure => [] }})
DESCRIPTION¶
Inspecting a mock object allows you to write slightly clearer tests than having a complex verification call.
"inspect" in Test::Magpie gives back an object of this class that has the same API as your mock object. When a method is called, it checks if any invocation matches its name and argument specification (inspectors can use argument matchers). If so it will return that invocation as a Test::Magpie::Invocation object. Otherwise, "undef" is returned.
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.
2020-11-24 | perl v5.26.1 |