Skip to content

Commit 7508183

Browse files
committed
chore(tests): Cleanup bootstrap.php to be forward-compatible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent d96395f commit 7508183

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

tests/unit/bootstrap.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/**
46
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
57
* SPDX-License-Identifier: AGPL-3.0-or-later
68
*/
79

10+
use OCP\App\IAppManager;
11+
use OCP\Server;
12+
use PHPUnit\Framework\TestCase;
13+
814
if (!defined('PHPUNIT_RUN')) {
915
define('PHPUNIT_RUN', 1);
1016
}
17+
1118
require_once __DIR__ . '/../../../../lib/base.php';
12-
\OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests');
13-
\OC_App::loadApp('user_saml');
14-
if (!class_exists(\PHPUnit\Framework\TestCase::class)) {
19+
require_once __DIR__ . '/../../../../tests/autoload.php';
20+
21+
Server::get(IAppManager::class)->loadApp('user_saml');
22+
23+
if (!class_exists(TestCase::class)) {
1524
require_once('PHPUnit/Autoload.php');
1625
}
26+
1727
OC_Hook::clear();

0 commit comments

Comments
 (0)