water has asked for the wisdom of the Perl Monks concerning the following question:
I can't seem to get this to work.
Note in the small example below, I can mock bar, but I can't mock isa. (And yes, I know my mocked isa is always true as written -- so that $mock->isa('Foo') and $mock->isa('NotAFoo') would both be true. Yes, I'll fix my mock isa, but for now, I can't even get the mock isa called.... I never see the warning.)
THanks for any advice
use Test::MockObject; use Test::More 'no_plan'; use strict; my $x = Test::MockObject->new( {} ); $x->fake_module('Foo'); $x->fake_new('Foo'); $x->mock( 'isa', sub { warn 'I dont get this warning'; 1 } ); $x->mock( 'bar', sub { 2 } ); is( $x->isa('Foo'), 1 ); is( $x->bar('Foo'), 2 );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mocking isa
by chromatic (Archbishop) on Apr 27, 2004 at 17:56 UTC | |
|
Re: Mocking isa
by blokhead (Monsignor) on Apr 27, 2004 at 17:53 UTC |