protalk/protalk — pull request #156 by Bendihossan (2013-02-15 22:11:33+00:00)
Title: Functional tests for getting a media page

* Improves findOneBySlug by using DQL to make the query easier to read/debug
* Adds a fixture for loading a single media entity
* Adds tests

The tests assert:
* the media item loaded data is persisted
* the views are incremented on when the page is viewed
* a 404 is thrown if a user gets the url (slug) wrong

I changed the ``findOneBySlug`` query so that it uses Doctrine's ``findOneOrNullResult`` as it was previously throwing a 500 (expected at least one row returned but none were found) when it should have been returning null to allow the controller to 404.