You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nextcloud-server/apps/files_external/tests/Storage/ConfigurableStorageTrait.php

30 lines
694 B

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files_External\Tests\Storage;
trait ConfigurableStorageTrait {
protected ?array $config = null;
protected function loadConfig(string $path): bool {
$this->config = null;
if (file_exists($path)) {
$this->config = include($path);
}
if (!$this->shouldRunConfig($this->config)) {
$this->markTestSkipped(__CLASS__ . ' Backend not configured');
return false;
}
return true;
}
protected function shouldRunConfig(mixed $config): bool {
return is_array($config) && ($config['run'] ?? false);
}
}