++ed by:
WATERKIP

1 PAUSE user

Wesley Schwengle

NAME

Test::Mock::Two - Inspection module for Test::Mock::One

VERSION

version 0.010

SYNOPSIS

    use Test::Mock::One;
    use Test::Mock::Two qw(:all);
    use Test::Deep;

    my $mock = Test::Mock::One->new(
        'X-Mock-Called' => 1,
    );

    # Do things in your testsuite

    # You may omit the test message, it defaults to a sane value
    one_called_ok($mock, 'foo', 'Pkg::Foo::bar', "'foo' called by Pkg::Foo::bar");
    one_called_times_ok($mock, 'foo', 'Pkg::Foo::bar', 1, "'foo' called once by Pkg::Foo::bar");

    # Check if the arguments are correct
    # one_called_ok and one_called_times_ok return the same values
    my $rv = one_called_times_ok($mock, 'foo', "Pkg::Foo::bar", 1);
    cmp_deeply($rv->[0], [], "Called without arguments");

    $rv = one_called_ok($mock, 'foo', "Pkg::Foo::bar");
    cmp_deeply($rv->[0], [], "Called without arguments");

DESCRIPTION

This module does the introspection of the Test::Mock::One object. This is to keep Test::Mock::One as empty as possible, implementing as little as possible additional methods.

EXPORTS

This module exports nothing by default, and has two export tags:

all

All functions

test

All test functions (everything ending with _ok)

METHODS

one_called

    one_called($mock, 'mock_method', "Pkg::Name::method");

Check if Pkg::Name::method called $mock->mock_method

one_called_ok

A Test::Builder enabled version of one_called.

one_called_times_ok

    one_called($mock, 'mock_method, "Pkg::Name::method", $times);

Test whether the mock object was called so many times for a given function.

SEE ALSO

AUTHOR

Wesley Schwengle <waterkip@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by Wesley Schwengle.

This is free software, licensed under:

  The (three-clause) BSD License