[Catalyst] Mocking for Catalyst testing

Tomas Doran bobtfish at bobtfish.net
Mon Jan 18 01:56:52 GMT 2010


On 17 Jan 2010, at 22:07, Stuart Watt wrote
>
> What I wanted to be able to do was mock out the remote job queue web  
> service, so at least I could check out that the front end render  
> stuff without to put an entire web server temporarily in place.  
> Basically, I'd hoped to replace the model that implements the web  
> service and check that the right stuff goes in and out.

Right - and _THIS_ is why you implement your model classes outside of  
Catalyst, and bind them in.

If you are using Catalyst::Model::Adaptor to bind an external class,  
then changing the implementation of the model class to a mock class in  
your test suite is a simple case of providing some config to change  
the name of the class which is adapted...

Cheers
t0m




More information about the Catalyst mailing list