aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/apps.php54
-rw-r--r--tests/bootstrap.php9
-rw-r--r--tests/enable_all.php18
-rw-r--r--tests/lib/Files/Storage/Storage.php2
-rw-r--r--tests/phpunit-autotest-external.xml45
-rw-r--r--tests/phpunit-autotest.xml40
6 files changed, 52 insertions, 116 deletions
diff --git a/tests/apps.php b/tests/apps.php
deleted file mode 100644
index 5e5286de404..00000000000
--- a/tests/apps.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-function loadDirectory($path): void {
- if (strpos($path, 'apps/user_ldap/tests/Integration')) {
- return;
- }
-
- if (! $dh = opendir($path)) {
- return;
- }
-
- while (($name = readdir($dh)) !== false) {
- if ($name[0] === '.') {
- continue;
- }
-
- $file = $path . '/' . $name;
- if (is_dir($file)) {
- loadDirectory($file);
- } elseif (str_ends_with($name, '.php')) {
- require_once $file;
- }
- }
-}
-
-function getSubclasses($parentClassName): array {
- $classes = [];
- foreach (get_declared_classes() as $className) {
- if (is_subclass_of($className, $parentClassName)) {
- $classes[] = $className;
- }
- }
-
- return $classes;
-}
-
-$apps = OC_App::getEnabledApps();
-$appManager = \OCP\Server::get(\OCP\App\IAppManager::class);
-
-foreach ($apps as $app) {
- try {
- $dir = $appManager->getAppPath($app);
- if (is_dir($dir . '/tests')) {
- loadDirectory($dir . '/tests');
- }
- } catch (\OCP\App\AppPathNotFoundException) {
- /* ignore */
- }
-}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 655b60f114b..8177b580965 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -16,8 +16,13 @@ require_once __DIR__ . '/autoload.php';
\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true);
-// load all enabled apps
-\OC_App::loadApps();
+// load all apps
+foreach (new \DirectoryIterator(__DIR__ . '/../apps/') as $file) {
+ if ($file->isDot()) {
+ continue;
+ }
+ \OC_App::loadApp($file->getFilename());
+}
OC_Hook::clear();
diff --git a/tests/enable_all.php b/tests/enable_all.php
index 54e5614e55a..b9320fa4edf 100644
--- a/tests/enable_all.php
+++ b/tests/enable_all.php
@@ -15,13 +15,11 @@ function enableApp($app) {
}
}
-enableApp('files_sharing');
-enableApp('files_trashbin');
-enableApp('encryption');
-enableApp('user_ldap');
-enableApp('files_versions');
-enableApp('provisioning_api');
-enableApp('federation');
-enableApp('federatedfilesharing');
-enableApp('admin_audit');
-enableApp('webhook_listeners');
+foreach (new \DirectoryIterator(__DIR__ . '/../apps/') as $file) {
+ if ($file->isDot()) {
+ continue;
+ }
+ if (!file_exists($file->getPathname() . '/.git')) {
+ enableApp($file->getFilename());
+ }
+}
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php
index c6f051fb7e1..99162e12834 100644
--- a/tests/lib/Files/Storage/Storage.php
+++ b/tests/lib/Files/Storage/Storage.php
@@ -557,7 +557,7 @@ abstract class Storage extends \Test\TestCase {
$this->instance->copy('source', 'target');
- $this->assertFalse($this->instance->file_exists('target/test2.txt'));
+ $this->assertFalse($this->instance->file_exists('target/test2.txt'), 'File target/test2.txt should no longer exist, but does');
$this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'));
}
diff --git a/tests/phpunit-autotest-external.xml b/tests/phpunit-autotest-external.xml
index fc3848d8cdb..d61d6839c2e 100644
--- a/tests/phpunit-autotest-external.xml
+++ b/tests/phpunit-autotest-external.xml
@@ -1,39 +1,30 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
<!--
+ - SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
- SPDX-License-Identifier: AGPL-3.0-only
-->
-<phpunit bootstrap="bootstrap.php"
- verbose="true"
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ bootstrap="bootstrap.php"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
->
- <testsuite name='ownCloud files external'>
- <directory suffix=".php">../apps/files_external/tests</directory>
+ cacheDirectory=".phpunit.cache"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
+ <testsuite name="Nextcloud files external">
+ <directory>../apps/files_external/tests</directory>
<!-- exclude backends as they are called separately -->
<exclude>../apps/files_external/tests/Storage/</exclude>
</testsuite>
- <!-- filters for code coverage -->
- <filter>
- <!-- whitelist processUncoveredFilesFromWhitelist="true" -->
- <whitelist>
+ <source>
+ <include>
<file>../lib/private/Files/Storage/DAV.php</file>
- <directory suffix=".php">../apps/files_external</directory>
- <exclude>
- <directory suffix=".php">../apps/files_external/l10n</directory>
- <directory suffix=".php">../apps/files_external/3rdparty</directory>
- <directory suffix=".php">../apps/files_external/tests</directory>
- </exclude>
- </whitelist>
- </filter>
- <!--<listeners>
- <listener class="StartSessionListener" file="startsessionlistener.php" />
- <listener class="TestCleanupListener" file="testcleanuplistener.php">
- <arguments>
- <string>detail</string>
- </arguments>
- </listener>
- </listeners>-->
+ <directory>../apps/files_external</directory>
+ </include>
+ <exclude>
+ <directory>../apps/files_external/l10n</directory>
+ <directory>../apps/files_external/3rdparty</directory>
+ <directory>../apps/files_external/tests</directory>
+ </exclude>
+ </source>
</phpunit>
-
diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml
index 532d5432bde..dde07915e79 100644
--- a/tests/phpunit-autotest.xml
+++ b/tests/phpunit-autotest.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
<!--
- SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -6,34 +6,30 @@
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
- verbose="true"
- backupGlobals="false"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
- convertDeprecationsToExceptions="true"
- xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd">
+ cacheDirectory=".phpunit.cache"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
<testsuite name="Nextcloud Server">
- <directory suffix=".php">lib/</directory>
- <directory suffix=".php">Core/</directory>
- <file>apps.php</file>
+ <directory>lib/</directory>
+ <directory>Core/</directory>
+ <directory>../apps/</directory>
+ <exclude>../apps/user_ldap/tests/Integration</exclude>
</testsuite>
- <coverage>
+ <source>
<include>
- <directory suffix=".php">..</directory>
+ <directory>..</directory>
</include>
<exclude>
- <directory suffix=".php">../3rdparty</directory>
- <directory suffix=".php">../apps/*/composer</directory>
- <directory suffix=".php">../apps/*/tests</directory>
- <directory suffix=".php">../apps/files_external/3rdparty</directory>
- <directory suffix=".php">../build</directory>
- <directory suffix=".php">../lib/composer</directory>
- <directory suffix=".php">../tests</directory>
- <directory suffix=".php">../vendor-bin</directory>
+ <directory>../3rdparty</directory>
+ <directory>../apps/*/composer</directory>
+ <directory>../apps/*/tests</directory>
+ <directory>../apps/files_external/3rdparty</directory>
+ <directory>../build</directory>
+ <directory>../lib/composer</directory>
+ <directory>../tests</directory>
+ <directory>../vendor-bin</directory>
</exclude>
- </coverage>
- <listeners>
- <listener class="StartSessionListener" file="startsessionlistener.php" />
- </listeners>
+ </source>
</phpunit>