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::MockPackages::Package - Helper package for mocking subroutines and methods on a given package.

VERSION

Version 0.5

SYNOPSIS

my $m = Test::MockPackages::Package->new('ACME::Widget');
  ->mock( 'do_thing' )
  ->expects( $arg1, $arg2 )
  ->returns( $retval );

CONSTRUCTOR

new( )

Instantiates and returns a new Test::MockPackages::Package object.

Both this package, and Test::MockPackages are light-weight packages intended to maintain scope of your mocked subroutines and methods. The bulk of your mocking will take place on Test::MockPackages::Mock objects. See that package for more information.

METHODS

mock( Str $name ) : Test::MockPackages::Mock

Instantiates a new Test::MockPackages::Mock object using for subroutine or method named $name. Repeated calls to this method with the same $name will return the same object.

Return value: A Test::MockPackages::Mock object.

SEE ALSO

Test::MockPackages::Mock

AUTHOR

Written by Tom Peters <tpeters at synacor.com>.

COPYRIGHT

Copyright (c) 2016 Synacor, Inc.