The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::Spy::Observer - method observer

SYNOPSIS

        $spy->set_base($base_object);
        my $method = $spy->add_observer('method_name');

        ok !$method->was_called;

DESCRIPTION

This class objects let you examine call data of a specific method without actually replacing its behavior.

Observer is similar to Test::Spy::Method, but it does not actually mock what the method is doing, only attaches itself to what already exists. For this reason, it makes sense to use it together with "base" in Test::Spy.

Call history methods

These methods are the same as documented in "Call history methods" in Test::Spy, but when called on this class objects, you don't need to setup "context" in Test::Spy.

SEE ALSO

Test::Spy::Method

Test::Spy