Reputation: 338
This is probably a really easy one, but I can't seem to find the answer.
I have written some custom assert functions for unit testing my models. I would like these functions to be available in all of my unit tests, no matter the model. Where would I put these so that they are available to every unit test?
Upvotes: 1
Views: 499
Reputation: 21743
I use MyCakeTestCase which extends the CakeTestCase. There I can put all my custom methods.
see this test for example: https://github.com/dereuromark/tools/blob/2.0/Test/Case/Lib/CaptchaLibTest.php
just put your own test case in your lib folder (either app or - as I prefer - plugin):
/app/Lib/
/app/Plugin/PluginName/Lib/
and either lib or pluginlib uses statement:
App::uses('MyCakeTestCase', 'Lib');
App::uses('MyCakeTestCase', 'PluginName.Lib');
Upvotes: 1