Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests of apps are broken #18765

Closed
nickvergessen opened this issue Sep 2, 2015 · 6 comments
Closed

Unit tests of apps are broken #18765

nickvergessen opened this issue Sep 2, 2015 · 6 comments
Milestone

Comments

@nickvergessen
Copy link
Contributor

PHP Fatal error:  Uncaught exception 'Exception' with message 'Path not allowed: /home/nickv/ownCloud/master/core/tests/lib/testcase.php' in /home/nickv/ownCloud/master/core/lib/autoloader.php:132
Stack trace:
#0 /home/nickv/ownCloud/master/core/lib/autoloader.php(152): OC\Autoloader->isValidPath('/home/nickv/own...')
#1 [internal function]: OC\Autoloader->load('Test\\TestCase')
#2 /home/nickv/ownCloud/master/core/repos/notifications/tests/testcase.php(24): spl_autoload_call('Test\\TestCase')
#3 /home/nickv/ownCloud/master/core/lib/autoloader.php(163): require_once('/home/nickv/own...')
#4 [internal function]: OC\Autoloader->load('OCA\\Notificatio...')
#5 /home/nickv/ownCloud/master/core/repos/notifications/tests/appinfo/RoutesTest.php(26): spl_autoload_call('OCA\\Notificatio...')
#6 /home/nickv/Tools/vendor/phpunit/phpunit/src/Util/Fileloader.php(93): include_once('/home/nickv/own...')
#7 /home/nickv/Tools/vendor/phpunit/phpunit/src/Util/Fileloader.php(77): PHPUnit_Util_Fileloader::load('/home/nickv/own...')
#8 /home/nickv/To in /home/nickv/ownCloud/master/core/lib/autoloader.php on line 132

Caused by #18396

FIX IT @icewind1991 @Xenopathic
or give an example on the activity/mail/gallery/notifications app so devs can copy it.
Also send an email to the dev mailing list with a code snippet that can be used to fix it.

// cc @oparoz

@nickvergessen nickvergessen added this to the 8.2-current milestone Sep 2, 2015
@RobinMcCorkell
Copy link
Member

include \OC::$SERVERROOT . '/tests/bootstrap.php

@icewind1991
Copy link
Contributor

Or add \OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); to your own bootstrap

@nickvergessen
Copy link
Contributor Author

Tests is removed on packaging, so why do this on the git repo?

@icewind1991
Copy link
Contributor

Because we want to make the autoloader as tight as possible, only allowing paths that are actually needed to run the code, /tests is not required to run the code, only the tests, so it should only be allowed for the tests

@nickvergessen
Copy link
Contributor Author

Well then follow one of the other steps I suggested above

@RobinMcCorkell
Copy link
Member

@nickvergessen Email has been sent to [email protected], all done 😄

@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants