Where is your framework when I need it?

The world has a million PHP frameworks, and now that I need one, there is not a single one that fulfils my requirements.

SemanticScuttle, my pet project, is a good ol' PHP project with several dozen files in the document root and which do a single task: login.php, register.php, admin.php, profile.php, edit.php - you name it.

While it works and Rasmus likes such code , does it make unit testing slow because I have to do real HTTP requests, and I cannot really re-use the action code in other situations. The proper solution is to use a framework/library for MVC and take the C from it. Alternatively, I could write it myself, debug it myself, maintain it myself and have all the hassle. But as I wrote, there are a million frameworks out there to use.

Requirements

Unit testing support

This is a thing that's very important for me. I want to unit test everything in the application, and I expect that a framework does as much work for me as possible.

Let's look at the tasks when testing a web application:

Those testing requirements are the same that most other web apps also have, thus the framework/controller library needs to assist me writing such standard tests.

I want predefined assertions for common uses, i.e. assertHttpResponseCode(200). Using assertEquals($res->getCode(), 200) is of course possible but I don't have a nice error message which I need when debugging the code half a year later, and it's just too much code to write when I have to do it again and again.

And no, I don't want to write those assertions myself. That's the framework's task!

The best tool for the task?

I've spent quite some time analyzing the existing frameworks: Zend Framework, Lithium, Yii, Kohona, CodeIgniter, Symfony2.

Zend has a nice ControllerTestCase class with dozens of the assertions I long for. Unfortunately, it's a big fat pack from which I can't pick the controller component only and automatically keep that up to date. Downloading the 6.x MiB minimal zip file after each release and copying the required files does not count.

All others don't have advanced unit testing support. Most don't have a PEAR channel (Symfony2 is the notable exception here) and the devs don't feel that it's necessary. Looks like they never worked professionally on a app that's supposed to run several years and needs security and feature updates without hassle.

What now?

It seems to me that everyone wrote an own framework because he wasn't satisified with others but failed to make it awesome and finish it to 100%.

Do you have an answer or suggestion? Then please comment on the stackoverflow question or send a mail.

Written by Christian Weiske.

Comments? Please send an e-mail.