Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

load app in bootstrap.php to fix php unit tests #1058

Merged
merged 1 commit into from
Sep 7, 2015

Conversation

ChristophWurst
Copy link
Contributor

this is needed in addition to #1023 because of new path restrictions of core (owncloud/core#18839)

@Gomez @irgendwie @Xenopathic @nickvergessen @oparoz

@nickvergessen
Copy link
Contributor

👍 because otherwise you can not run your tests anymore atm

@oparoz
Copy link
Contributor

oparoz commented Sep 7, 2015

@ChristophWurst - Try to remove \OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); to see if it still works. It does in Gallery.

@ChristophWurst
Copy link
Contributor Author

@ChristophWurst - Try to remove \OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); to see if it still works. It does in Gallery.

Doesn't work for mail:

$ phpunit -c tests/phpunit.xml 
PHP Fatal error:  Uncaught exception 'OCP\AutoloadNotAllowedException' with message 'Autoload path not allowed: /home/christoph/workspace/owncloud/tests/lib/testcase.php' in /home/christoph/workspace/owncloud/lib/autoloader.php:134
Stack trace:
#0 /home/christoph/workspace/owncloud/lib/autoloader.php(154): OC\Autoloader->isValidPath('/home/christoph...')
#1 [internal function]: OC\Autoloader->load('Test\\TestCase')
#2 /home/christoph/workspace/owncloud/apps/mail/tests/controller/accountscontrollertest.php(28): spl_autoload_call('Test\\TestCase')
#3 phar:///usr/share/webapps/bin/phpunit.phar/phar/phpunit/Util/Fileloader.php(52): include_once('/home/christoph...')
#4 phar:///usr/share/webapps/bin/phpunit.phar/phar/phpunit/Util/Fileloader.php(36): PHPUnit_Util_Fileloader::load('/home/christoph...')
#5 phar:///usr/share/webapps/bin/phpunit.phar/phar/phpunit/Framework/TestSuite.php(331): PHPUnit_Util_Fileloader::checkAndLoad('/home/christoph...')
#6 phar:///usr/share/webapps/bin/phpunit.phar/phar/phpunit/Framework/TestSuite.php(403 in /home/christoph/workspace/owncloud/lib/autoloader.php on line 134

ChristophWurst added a commit that referenced this pull request Sep 7, 2015
load app in bootstrap.php to fix php unit tests
@ChristophWurst ChristophWurst merged commit 5b01a96 into master Sep 7, 2015
@ChristophWurst ChristophWurst deleted the fix-autoloader-path branch September 7, 2015 10:58
@oparoz
Copy link
Contributor

oparoz commented Sep 7, 2015

Thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants