I adapted Bernhardt's way to write those stuff and create a protected member variable - i.e. $config - and set it up in the setUp method. So it hasn't to be instantiated every time a test is called. For example see the $api variable here https://github.com/owncloud/music/blob/master/tests/unit/businesslayer/AlbumBusinessLayerTest.php#L44