About ten years ago there was a rumour. If you want to get things done, and if you want to get them done fast, go for PHP. Yes, it’s been like a badly done perl ripoff with even worse object orientation and inconsistent apis, but somehow the people creating in software in PHP were able to deliver. And they were able to deliver fast, open for changes in the last 24 hours and they fixed bugs in production fast. From a software engineering professionals point of view this sounded risky, unprofessional and dangerous. This could only lead to crappy code. A proper software engineer would never use this language, and he won’t ever accept changes in the last minute nor work with a customer that does not know exactly what he wants.
During the development of an application, not all time is spent on writing code. A lot of time is spent on reading debug output, crawling through log files and firing up the debugger to figure out what the application does. While the debugger helps us to inspect details of a running application on a testing environment, logfiles are often the only indication of the origin of an error on a production system. In this blogpost I want to describe how to log SQL statements on an existing application without touching any existing line of code at all. We will use a new MySQLnd Extension developed at the Mayflower OpenSource Labs for
As an example, I will use PHProjekt 6. The project is particularly suitable for demonstration purposes as it has a logging infrastructure for function calls, but does not log SQL statements.
Sometimes developers aren’t motivated to write a lot of unit tests.
Now we got some help when your phpunit code coverage goes below 80%. A PHPUnit Motivational Poster, done by the anonymous phpunit fan club.