GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test::Mock::Two(3) User Contributed Perl Documentation Test::Mock::Two(3)

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

version 0.011

    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");

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.

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

All functions
All test functions (everything ending with _ok)

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

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

A Test::Builder enabled version of "one_called".

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

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

Wesley Schwengle <waterkip@cpan.org>

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

This is free software, licensed under:

  The (three-clause) BSD License
2018-08-13 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.