[Catalyst] getting $c in model unit test
Matt Lawrence
matt.lawrence at ymogen.net
Tue May 15 15:32:31 GMT 2007
Nathan Gray wrote:
> I would like to test a model with a unit test. Catalyst kindly
> generates stub unit tests for models, but it does not include a stub
> showing how to instantiate the context object.
>
>
I think I mentioned this on another thread earlier on. Something about
Chuck Norris if memory serves. Anyway:
my $controller = MyApp->controller('MyController');
my $c = MyApp->prepare();
# Monkey with $c to set up a fake context (set req->uri, or params)
my $result = $c->forward($controller, 'method_to_test', \@args);
Matt
More information about the Catalyst
mailing list