Error in PHPunit TEst

Helle there,

I’am doing the app development tutorial and when I run phpunit in my test app I get the following error:

PHP Fatal error: Uncaught Error: Call to a member function addPsr4() on bool in /var/www/html/lib/private/legacy/OC_App.php:283

I’m using nextcloud v.20 and PHPunit 8.5

Would be awesome if someone could give me a hint.

which tutorial are you following specifically? from taking a look at the code I’m assuming that Nextcloud isn’t properly initialized before your tests access it, hence the error

Hi Christoph,

thank you for your quick reply. I am doing this tutorial: https://docs.nextcloud.com/server/latest/developer_manual/app_development/tutorial.html

Can you give me a hint how I can find out what went wrong with the initiation?

I basicly did not do anything crazy. Just cloned the nexcloud code, checked out the Version 20 Branch and ran the installation routine.

I run it in a docker container provided bei ddev. https://ddev.readthedocs.io/en/stable/users/cli-usage/#php-project-quickstart

Did you initialize/update the 3rdparty git submodule?

yes, and everything works fine when I click through the app.

is the code anywhere public, so I could quickly check it out and reproduce?

my time is limited, sorry

sorry, i only have a local environment so far.

But no problem, if this error message does not immediatly ring any bells, i will dig into it and try to figure it out.

1 Like