What can we learn from CakePHP tests?

Update: Currently the API for test cases searches is down (but coming back soon).
Remember, that you still have the test cases in the core of cake, so you can and should utilize them all the time ;)
(If anyone wishes to volunteer their time to help out to bring test case search online, please contact Gwoo or Mark Story)

First things first, all current CakePHP test cases are now searchable here:

If you ever find yourself stuck wondering how to use some feature in CakePHP look to the test cases to provide a helpful hint.

Let’s consider an example.

I don’t know how to use SQL’s BETWEEN syntax in cake… let’s see if there are any matches for “between” in the test cases.

Search at the above link, and a few results, but here’s one: DboSourceTest::testArrayConditionsParsing
Hmm… conditions parsing? Sounds about right…
And looky-looky what we’ve got there.
All sorts of examples including the BETWEEN syntax.

Hopefully you can see how great it is to have the test cases available and how much you can discover and learn by digging around in the tests source code.

Related Posts