I wish I could have an isSQLCountLessThan() function or something.
$browser = new sfTestFunctional(new sfBrowser());
$browser
->get('/some/page')
->with('response')->begin()
->isStatusCode(200)
// ...
->isSQLCountLessThan(20) // imagine how cool :)
->end();
Is there a way to have such?
I once created tester for this purpose. It’s based on how it’s done in web debug toolbar (sfWebDebugPanelDoctrine class).
I extended sfTesterDoctrine so it behaves the same. Only assertion method is added to check query count.
You could also overwrite debug() method to show query statistics.
Example usage: