Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Using Test::MockObject

by shigetsu (Hermit)
on Jun 10, 2007 at 03:28 UTC ( [id://620241]=note: print w/replies, xml ) Need Help??


in reply to Using Test::MockObject

Test::MockObject states (not so sure whether it's relevant to your case):

If you use fake_module() to mock a module that already exists in memory -- one you've loaded elsewhere perhaps, but do not pass any subroutines to mock, this method will throw an exception. This is because if you call the constructor later on, you probably won't get a mock object back and you'll be confused.

What happens if you try

can_ok($module,'new'); can_ok($module,'load'); my $gq=Games::QuizTaker->new(filename=>'t/testqa'); $gq->load;
instead?

Replies are listed 'Best First'.
Re^2: Using Test::MockObject
by chromatic (Archbishop) on Jun 10, 2007 at 06:43 UTC

    As long as the use_ok() call happens after the fake_module() call, this should make no difference.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://620241]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-18 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found