Steven Lee > Test-Magpie > Test::Magpie::Inspect

Download:
Test-Magpie-0.11.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.11   Source  

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 ^

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.

syntax highlighting: