Skip to content

Commit 2fda8f7

Browse files
committed
sorted directories to create consistent/readable order of execution
1 parent 5a14398 commit 2fda8f7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/unit/ls.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<?php
22
header("Content-Type: application/json");
33

4-
$response = array( 'directories' => array());
4+
$directories = array();
55

66
if ($handle = opendir(getcwd())) {
77
while (false !== ($file = readdir($handle))) {
88
if (is_dir($file) && $file[0] !== "." ) {
9-
array_push($response['directories'], $file);
9+
array_push($directories, $file);
1010
}
1111
}
1212

1313
closedir($handle);
1414
}
1515

16-
echo json_encode($response)
16+
sort($directories);
17+
echo json_encode( array('directories' => $directories ));
1718
?>

0 commit comments

Comments
 (0)