mirror of https://github.com/nextcloud/server
Refactors tests/app.php to improve readaibility.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
This commit is contained in:
parent
912b18b1fc
commit
c322224650
|
@ -6,28 +6,34 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function loadDirectory($path) {
|
function loadDirectory($path): void {
|
||||||
if (strpos($path, 'integration')) {
|
if (strpos($path, 'integration')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($path, 'Integration')) {
|
if (strpos($path, 'Integration')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($dh = opendir($path)) {
|
|
||||||
while ($name = readdir($dh)) {
|
if (! $dh = opendir($path)) {
|
||||||
if ($name[0] !== '.') {
|
return;
|
||||||
$file = $path . '/' . $name;
|
}
|
||||||
if (is_dir($file)) {
|
|
||||||
loadDirectory($file);
|
while ($name = readdir($dh)) {
|
||||||
} elseif (substr($name, -4, 4) === '.php') {
|
if ($name[0] === '.') {
|
||||||
require_once $file;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$file = $path . '/' . $name;
|
||||||
|
if (is_dir($file)) {
|
||||||
|
loadDirectory($file);
|
||||||
|
} elseif (str_ends_with($name, '.php')) {
|
||||||
|
require_once $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSubclasses($parentClassName) {
|
function getSubclasses($parentClassName): array {
|
||||||
$classes = [];
|
$classes = [];
|
||||||
foreach (get_declared_classes() as $className) {
|
foreach (get_declared_classes() as $className) {
|
||||||
if (is_subclass_of($className, $parentClassName)) {
|
if (is_subclass_of($className, $parentClassName)) {
|
||||||
|
|
Loading…
Reference in New Issue