Skip to content

tokuhirom/Test-CallCounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Test::CallCounter - Count the number of method calling

SYNOPSIS

use Test::CallCounter;

my $counter = Test::CallCounter->new(
    'LWP::UserAgent' => 'get'
);

my $ua = LWP::UserAgent->new();
$ua->get('http://d.hatena.ne.jp/');

is($counter->count(), 1);

DESCRIPTION

Test::CallCounter counts the number of method calling.

METHODS

  • my $counter = Test::CallCounter->new($class_name, $method_name)

    Make a instance of Test::CallCounter and hook $method_name method in $class_name to count calling method.

  • $counter->count();

    Get a calling count of $method_name.

  • $counter->reset()

    Reset counter.

AUTHOR

Tokuhiro Matsuno tokuhirom@gmail.com

SEE ALSO

Test::Mock::Guard

If you want to do more complex operation while monkey patching, see also Test::Resub.

LICENSE

Copyright (C) Tokuhiro Matsuno

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages