[Catalyst] Unit Testing

Yao Wang S3115360 at student.rmit.edu.au
Mon Apr 21 09:01:17 BST 2008


Hi Everyone,

After some research and tries. The testing code looks like following:

BEGIN { use_ok 'MyApp::Controller::abc' };

my $c = MyApp->prepare();

$c = Test::MockObject::Extends->new($c);

$c->set_always('forward',{});

MyApp::Controller::abc->get_info( $c);

ok($c->stash->{template} eq "get_info.tt2", "comparing template returned for get_ info page");

What i tried  is to check stash is correct and allow forward. 

What do you think about this ?

Thanks,
61966



More information about the Catalyst mailing list