1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
use warnings;
use strict;
use Test::More;
use Test::Warnings;
use Test::MockModule;
my $mocker = Test::MockModule->new('Mockee')->mock( good => 51 )
->redefine( to_redefine => sub { 42 } )->define( something => 1234 );
isa_ok $mocker, 'Test::MockModule';
is( Mockee::good(), 51, 'mock() works when chaining with new' );
is( Mockee::to_redefine(), 42, 'redefine() works when chaining with new' );
is( Mockee::something(), 1234, 'something() works when chaining with new' );
done_testing();
#----------------------------------------------------------------------
package Mockee;
our $VERSION;
BEGIN { $VERSION = 1 }
sub good { 1 }
sub to_redefine { 1 }
1;
|