Add a DB test for Media::UserCanEdit

This required a lot of db interaction changes and framework to support db changes.

* Moved install/update logic into re-useable code
* Created helper classes for db testing
* Support two DSNs (production and testing)
* DB testing involves:
 1: cleaning the database
 2: installing db structure
 3: installing mock data
 4: executing tests

To run, you will first have to:
* Run `vagrant provision` Add a testing DB to vagrant
* Update config to reflect code changes (see config.sample.php)

I've updated the pull request to move test related logic to the tests directory.  This includes classes and config (dsn).  I've kept the public static `$dsn` variable, but removed the others.  The static variable makes sense to me because many scripts might call the mediahub constructor in order to set up the doctrine connection, and those scripts don't need to know the DSN or even change it.   Once the DSN is set, it won't change for the rest of the execution.

The alternative that I see here is to create an init script that is included at the beginning of every script which will include the config and establish a connection to the database.  That change however can be tackled outside of this pull request.