Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors tests/app.php to improve code readability. #36742

Merged
merged 1 commit into from
Sep 27, 2023
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
30 changes: 18 additions & 12 deletions tests/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@
* See the COPYING-README file.
*/

function loadDirectory($path) {
function loadDirectory($path): void {
if (strpos($path, 'integration')) {
return;
}

if (strpos($path, 'Integration')) {
return;
}
if ($dh = opendir($path)) {
while ($name = readdir($dh)) {
if ($name[0] !== '.') {
$file = $path . '/' . $name;
if (is_dir($file)) {
loadDirectory($file);
} elseif (substr($name, -4, 4) === '.php') {
require_once $file;
}
}

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;
}
}
}

function getSubclasses($parentClassName) {
function getSubclasses($parentClassName): array {
$classes = [];
foreach (get_declared_classes() as $className) {
if (is_subclass_of($className, $parentClassName)) {
Expand Down
Loading