`composer test` fails due to missing `base.php`

I’m trying to set up the development environment of the Calendar app. After installing composer and following the instructions of GitHub - nextcloud/calendar: 📆 Calendar app for Nextcloud, I run composer test. I get this error right away:

PHP Warning: require_once([REDACTED]/calendar/tests/php/unit/…/…/…/…/…/lib/base.php): Failed to open stream: No such file or directory in [REDACTED]/calendar/tests/php/unit/bootstrap.php on line 26

It looks like the path in the error makes some unclarified assumptions about where the repository should be, as all these ../../ take us outside the repo. Additionally, I searched my entire filesystem and didn’t find a base.php file. I’ve installed php.

How can I find base.php and make bootrstrap.php see it properly?

Thanks!

Hi !

I think you must run composer test as www-data user.

For example :

sudo -u www-data composer test

Or, if you use nginx :

sudo -u nginx composer test

Do I also need a full nextcloud server installation?

Yes, you need to install your nextcloud server for the development environment.

If you need, you can use this development environment by Julius : GitHub - juliushaertl/nextcloud-docker-dev: Nextcloud development environment using docker-compose

I am not sure that you need a full installation. In any case, you need a server dev environment, aka a git checkout not only a tarball from the homepage. The tarball has some files (like the test files) filtered out. These are only present in the git repository.

The app under consideration (like the calendar app in your case) must reside in a folder 1 folder below the checked out server repo. For example, you need to check out to e.g. apps/calendar or custom_apps/calendar. Then, the paths to the base.php and similar should be found correctly.

Regarding the user to run the tests, I would suggest, to checkout both the server and the calendar app as your main user. Then, the tests can be run as your normal user.

Christian