2012-10-08 14:26:51 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2023-09-27 07:38:43 +02:00
|
|
|
function loadDirectory($path): void {
|
2015-05-15 16:38:21 +02:00
|
|
|
if (strpos($path, 'integration')) {
|
|
|
|
return;
|
|
|
|
}
|
2023-09-27 07:38:43 +02:00
|
|
|
|
2016-05-25 16:51:02 +02:00
|
|
|
if (strpos($path, 'Integration')) {
|
|
|
|
return;
|
|
|
|
}
|
2023-09-27 07:38:43 +02:00
|
|
|
|
|
|
|
if (! $dh = opendir($path)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ($name = readdir($dh)) {
|
|
|
|
if ($name[0] === '.') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$file = $path . '/' . $name;
|
|
|
|
if (is_dir($file)) {
|
|
|
|
loadDirectory($file);
|
|
|
|
} elseif (str_ends_with($name, '.php')) {
|
|
|
|
require_once $file;
|
2012-10-08 14:26:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-27 07:38:43 +02:00
|
|
|
function getSubclasses($parentClassName): array {
|
2020-03-26 09:30:18 +01:00
|
|
|
$classes = [];
|
2012-10-08 14:26:51 +02:00
|
|
|
foreach (get_declared_classes() as $className) {
|
2020-04-10 14:19:56 +02:00
|
|
|
if (is_subclass_of($className, $parentClassName)) {
|
2012-10-08 14:26:51 +02:00
|
|
|
$classes[] = $className;
|
2020-04-10 14:19:56 +02:00
|
|
|
}
|
2012-10-08 14:26:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $classes;
|
|
|
|
}
|
|
|
|
|
|
|
|
$apps = OC_App::getEnabledApps();
|
|
|
|
|
|
|
|
foreach ($apps as $app) {
|
|
|
|
$dir = OC_App::getAppPath($app);
|
|
|
|
if (is_dir($dir . '/tests')) {
|
|
|
|
loadDirectory($dir . '/tests');
|
|
|
|
}
|
|
|
|
}
|