[owncloud-devel] Having failing database depending unit tests locally? - There's a fix for it

Joas Schilling nickvergessen at owncloud.com
Mon Dec 14 09:22:48 GMT 2015


Hi App devs,

last week we did a little change, that makes database depending tests 
fail with the following error:

    Your test case is not allowed to access the database.


The idea behind that is, that you are forced to correctly specify which 
tests require database interaction
and which tests don't. With phpunit's group settings you can mark a file 
as database depending,
just add "@group DB" into the doc block of the test:
https://github.com/owncloud/activity/pull/438/files#diff-faa57747b4b645ad449d2b8c8650b8b8

Then in theory we can only run those tests against the different 
databases, that actually use it.
For apps that advantage might be negligible, but in core we can save 
multiple minutes with that
on each test execution. With hundreds of executions per day, that brings 
us in a better shape
and faster overall responses.

If you want to only execute database tests, you would adjust your call from

    phpunit --configuration phpunit.xml

to

    phpunit --configuration phpunit.xml --group DB


Hope that helps, sorry for the late note, instead of a heads up before 
the fix.

cheers
Joas aka. nickvergessen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.owncloud.org/pipermail/devel/attachments/20151214/5203ec22/attachment-0001.html>


More information about the Devel mailing list