In my continuing adventure to try to write an app, I got to the point of running unit tests for the example app at GitHub - nextcloud/app-tutorial: Tutorial app which is built in the tutorial.
When I run make test
the tests don’t even get a chance to run:
./vendor/phpunit/phpunit/phpunit -c phpunit.xml
PHP Warning: require_once(/var/www/nextcloud/apps/app-tutorial/tests/../../../tests/bootstrap.php): Failed to open stream: No such file or directory in /var/www/nextcloud/apps/app-tutorial/tests/bootstrap.php on line 3
PHP Fatal error: Uncaught Error: Failed opening required '/var/www/nextcloud/apps/app-tutorial/tests/../../../tests/bootstrap.php' (include_path='.:/usr/share/php') in /var/www/nextcloud/apps/app-tutorial/tests/bootstrap.php:3
The bootstrap.php
file contains only:
<?php
require_once __DIR__ . '/../../../tests/bootstrap.php';
It seems like the path is just incorrect so I fudged it and removed two levels of ..
and tried again. But this time:
PHP Fatal error: Uncaught Error: Class "OCA\NotesTutorial\Tests\Unit\Controller\NoteControllerTest" not found in /var/www/nextcloud/apps/app-tutorial/tests/Unit/Controller/NoteApiControllerTest.php:7
I can’t seem to satisfy phpunit by adding use
s. The file seems to be in the right place. Maybe changing the bootstrap path messes up something? I’m still to new to this to figure out what is going on.
Ideas?