Test::Mock::Two(3)
πΈ NAME πΈ
okay bestie, welcome to the Test::Mock::Two(3) page β it's giving User Contributed Perl Documentation main character energy, and we're obsessed. π
Test::Mock::Two - Inspection module for Test::Mock::One
β¨ VERSION β¨
version 0.011 β yes ma'am, that's the version. π
π¦ 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 π
So like, this module does the introspection of the Test::Mock::One object. The whole point is to keep Test::Mock::One as empty as possible, implementing as little as possible additional methods. It's giving minimalism, fr fr β and honestly? Slay. π
π EXPORTS π
This module exports nothing by default, and has two export tags:
allβ All functionstestβ All test functions (everything ending with_ok)
π METHODS π
π one_called π
one_called($mock, 'mock_method', "Pkg::Name::method");
Checks 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);
Tests whether the mock object was called so many times for a given function.
π SEE ALSO π
Ngl bestie, this section is empty in the original β no SEE ALSO refs listed. π«Ά
πΈ 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
And that's the whole page, bestie β brought to you by perl v5.42.2, dated 2023-10-04, and signed off by Test::Mock::Two(3). Stay slay, keep testing, mwah πβ¨
π¦ where this page comes from
- alpine 3.24: perl-test-mock-one-doc 0.011-r2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms