Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 12 additions & 33 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,25 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <[email protected]>
* @author Jörn Friedrich Dreyer <[email protected]>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

use OCP\App\IAppManager;
use OCP\Server;
use PHPUnit\Framework\TestCase;

if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}

require_once __DIR__ . '/../../../lib/base.php';
require_once __DIR__ . '/../../../tests/autoload.php';

// Fix for "Autoload path not allowed: .../tests/lib/testcase.php"
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');

// Fix for "Autoload path not allowed: .../activity/tests/testcase.php"
\OC_App::loadApp('activity');
Server::get(IAppManager::class)->loadApp('activity');

// Fix for "Autoload path not allowed: .../files/lib/activity.php"
\OC_App::loadApp('files');

// Fix for "Autoload path not allowed: .../files_sharing/lib/activity.php"
\OC_App::loadApp('files_sharing');

if (!class_exists('\PHPUnit\Framework\TestCase')) {
if (!class_exists(TestCase::class)) {
require_once('PHPUnit/Autoload.php');
}

OC_Hook::clear();
Loading