How do I run controller tests for core apps?

Hi, I’m trying to make a change to ShareAPIController.php in the files_sharing app (which is part of the core nextcloud server repo, not a separate app with its own repo).

When I run phpunit tests/Controller/ShareAPIControllerTest.php, I get this error message:

Fatal error: Uncaught Error: Class "Test\TestCase" not found in

I haven’t been able to figure out how to run those tests locally. I’ve tried looking at how it’s done in the github actions config, but couldn’t find it.

I’m running Nextcloud locally by following this tutorial.

Does anyone know how to run those tests locally?

I just found it, you run composer run test path/to/test.php instead of running phpunit directly.

For my own future reference, is that documented anywhere?

1 Like

I don’t know if it’s normal :thinking:

Because, you can run all tests and not run test by test.

@Daphne Do you know if it’s a situation normal? :thinking: