diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index 4b6f2d54583413bc2d3447dc77bdbd54254438bd..d5ccde6bba3998b51dfb1c1d1e87570fc741f969 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -438,7 +438,7 @@ class Setup {
 	 * @return string
 	 * @throws InvalidArgumentException when invalid value for overwrite.cli.url
 	 */
-	public static function findWebRoot(SystemConfig $config): string {
+	private static function findWebRoot(SystemConfig $config): string {
 		// For CLI read the value from overwrite.cli.url
 		if (\OC::$CLI) {
 			$webRoot = $config->getValue('overwrite.cli.url', '');
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index fc9def6e1c3b8fb469680556eebe2d354038e4e6..628f9393c1509f74650adda82417749a6d40d895 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -147,7 +147,7 @@ class SetupTest extends \Test\TestCase {
 		\OC::$CLI = true;
 
 		try {
-			$webRoot = $this->setupClass::findWebRoot($this->config);
+			$webRoot = self::invokePrivate($this->setupClass, 'findWebRoot', [$this->config]);
 		} catch (\InvalidArgumentException $e) {
 			$webRoot = false;
 		}