[test][phpunit] Solution to get screenshot on failure and handle DB for phpunit tests

@catchamonkey 

Closes #12