I use MockObjects in some of my tests and just had to test the function with the SUPER class call, and I can't get it to work. Can UNIVERSAL call $ this-> SUPER :: save () not to mock? If so, how do you do it?
Thanks.
Edit:
Found!
Use fake_module from Test::MockObject
So, let your base module be Some::Module , and your routine will call $this->SUPER::save , use
my $child_class_mockup = Test::MockObject->new(); $child_class_mockup->fake_module( 'Some::Module', save => sub () { return 1; } );
Leaving the question open for a couple of days to get information about the various methods / libraries for this action (what if the SUPER call had a SUPER call?) Before accepting this answer.
Gaurav dadhania
source share