Skip to content

Commit d200884

Browse files
Merge pull request #1175 from nextcloud/fix/cleanup-tests-bootstrap
2 parents 171fbb0 + f7f393d commit d200884

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

tests/bootstrap.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
<?php
22

3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
use OCP\App\IAppManager;
11+
use OCP\Server;
12+
use PHPUnit\Framework\TestCase;
13+
314
if (!defined('PHPUNIT_RUN')) {
415
define('PHPUNIT_RUN', 1);
516
}
617

718
require_once __DIR__ . '/../../../lib/base.php';
19+
require_once __DIR__ . '/../../../tests/autoload.php';
820

9-
// Fix for "Autoload path not allowed: .../tests/lib/testcase.php"
10-
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
21+
Server::get(IAppManager::class)->loadApp('privacy');
1122

12-
// Fix for "Autoload path not allowed: .../privacy/tests/testcase.php"
13-
\OC_App::loadApp('privacy');
14-
15-
if (!class_exists('\PHPUnit\Framework\TestCase')) {
23+
if (!class_exists(TestCase::class)) {
1624
require_once('PHPUnit/Autoload.php');
1725
}
18-
19-
OC_Hook::clear();

0 commit comments

Comments
 (0)