|
NAMETest::Mock::Two - Inspection module for Test::Mock::One VERSIONversion 0.011 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");
DESCRIPTIONThis 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. EXPORTSThis module exports nothing by default, and has two export tags: METHODSone_calledone_called($mock, 'mock_method', "Pkg::Name::method"); Check if "Pkg::Name::method" called $mock->mock_method one_called_okA Test::Builder enabled version of "one_called". one_called_times_okone_called($mock, 'mock_method, "Pkg::Name::method", $times); Test whether the mock object was called so many times for a given function. SEE ALSOAUTHORWesley Schwengle <waterkip@cpan.org> COPYRIGHT AND LICENSEThis software is Copyright (c) 2017 by Wesley Schwengle. This is free software, licensed under: The (three-clause) BSD License
|