Re:Keep Your ORM Out of my Controller
by Daniel_Newby on Thursday August 26, 2010 @03:47PM
(#1636963)
> I find it hard to imagine another way to get code that is as easy to test and to mock. Any suggestion?
If you need a special data store for testing, just point the ORM at a test database. You don't need a half-assed database simulator when you can have as many real databases as you need.
Re:Keep Your ORM Out of my Controller
by mononcqc on Thursday August 26, 2010 @03:52PM
(#1636975)
That doesn't let you test ORM queries alone or controller code alone, though. They get bundled together and the testing is necessarily done on a higher level. I guess this can be acceptable in most situations.
Re:Keep Your ORM Out of my Controller
by cageface on Thursday August 26, 2010 @04:06PM
(#1637015)
I actually prefer this most of the time. Bugs tend to crop up between stack layers so testing as much of the stack as possible at once is more effective, IMO.
If you need a special data store for testing, just point the ORM at a test database. You don't need a half-assed database simulator when you can have as many real databases as you need.