[owncloud-devel] Behavioural change in app unit tests
rmccorkell at owncloud.com
Thu Sep 3 08:15:48 GMT 2015
All app developers, please note that due to recent security enhancements
in ownCloud 8.2 regarding restrictions on the autoloader, there is an
additional step you must ensure to keep your PHPUnit app unit tests
working. The autoloader now restricts the directories it will load files
from, and by default excludes the /tests directory, so you may see
errors like 'Path not allowed: .../tests/lib/testcase.php' when trying
to run your unit tests.
There are two solutions to this, the recommended way is to use
ownCloud's test bootstrap (tests/bootstrap.php), which correctly
initializes the autoloader and sets up other useful variables besides.
Alternatively, if you use your own bootstrap, simply call
\OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests');
before using any test classes.
The documentation at
has been updated with the first method, and an issue is open to
implement support in ocdev: https://github.com/owncloud/ocdev/issues/38
More information about the Devel