[Catalyst] getting $c in model unit test

Matt Lawrence matt.lawrence at ymogen.net
Thu May 17 17:42:03 GMT 2007


Matt S Trout wrote:
> On Wed, May 16, 2007 at 10:11:56AM +0100, Matt Lawrence wrote:
>   
>> Ah yes. You don't normally forward to a Model. If you're testing a
>> controller (or, I suppose, a view), it's best to forward, otherwise you
>> get a similar error if the controller method you're calling forwards to
>> another method itself.
>>     
>
> Maybe that means there's a case for adding a context($uri) export to C::Test
>
>   

I suppose that would come in useful in some situations, but the question
is how much stuff would get done before the context gets returned. You
could stop before you call the action, having called the relevant begin
and auto methods, but then what could you usefully test other than the
action itself?

If you return the context after the request has been finalised, it would
be useful for ensuring the internal state is as you expect, as well as
the actual response. But it might not be so useful for unit testing to
have a finalised context.


Matt




More information about the Catalyst mailing list