Just a quick note, the CakePHP PHPUnit installer has been updated to use version 3.7.8. Go grab it here if you are no fan of PEAR and want a self contained PHPUnit testing system. Works on Mac OSX, Linux and Windows.
I was breaking my head over failing unit tests when trying to test a simple Controller that was saving a new record. Turned out it was failing only on the command line, while the webversion was passing all the tests. Luckily, the solution was simple .. The PHPUnit command line suite apparently outputs contents early, before the session gets initiated. Solution 1 Add --stderr to the command line: $ cake testsuite app Controller/YourFancyController --stderr This will pass the tests again, as it doesn’t output contents early to STDOUT.
Just a small update .. I updated the PHPUnit Installer Shell for CakePHP 2.0 to use version 3.6.4. All dependencies have been updated as well, so it’s 23% more awesome.
I was trying to get into Unit Testing a few months ago. It was a steep learning curve and eventually I gave myself a non-excuse and decided to wait for Cake 2.0 as that would have PHPUnit and it “wouldn’t make sense to learn SimpleTest” at that time. I intend to keep that promise and have been trying to get into Unit Testing for real this time. The first thing was also the most annoying so far: installing the (&#(&.