summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-11-15 19:20:43 -0800
committerBharat Mediratta <bharat@menalto.com>2009-11-15 19:20:43 -0800
commit731ff800cdc204a3a9bb468148bff6ce5de9e980 (patch)
tree8f3441011e4a32f3fb8f9af9f838fe8d5766202a /modules/gallery
parent5a27ce7e8f3f90b20ba6aee7f83740776a82b578 (diff)
Use 'git ls-files' instead of glob() so that we only check files known
to Git. This means that local files which we choose to exclude from git don't have to follow the same permission model.
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/tests/Controller_Auth_Test.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php
index caf6d8f2..0a7076c6 100644
--- a/modules/gallery/tests/Controller_Auth_Test.php
+++ b/modules/gallery/tests/Controller_Auth_Test.php
@@ -25,13 +25,18 @@ class Controller_Auth_Test extends Unit_Test_Case {
public function find_missing_auth_test() {
$found = array();
- $controllers = glob("*/*/controllers/*.php");
- $feeds = glob("*/*/helpers/*_rss.php");
+ $controllers = explode("\n", `git ls-files '*/*/controllers/*.php'`);
+ $feeds = explode("\n", `git ls-files '*/*/helpers/*_rss.php'`);
foreach (array_merge($controllers, $feeds) as $controller) {
if (preg_match("{modules/(gallery_)?unit_test/}", $controller)) {
continue;
}
+ if (!$controller) {
+ // The last entry in each list from git ls-files appears to be an empty line
+ continue;
+ }
+
// List of all tokens without whitespace, simplifying parsing.
$tokens = array();
foreach (token_get_all(file_get_contents($controller)) as $token) {
@@ -118,7 +123,7 @@ class Controller_Auth_Test extends Unit_Test_Case {
if ($token[1] == "access" &&
self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) &&
self::_token_matches(array(T_STRING), $tokens, $token_number + 2) &&
- in_array($tokens[$token_number + 2][1], array("forbidden", "required")) &&
+ in_array($tokens[$token_number + 2][1], array("forbidden", "required")) &&
self::_token_matches("(", $tokens, $token_number + 3)) {
$token_number += 3;
$function->checks_authorization(true);
@@ -149,7 +154,7 @@ class Controller_Auth_Test extends Unit_Test_Case {
}
}
}
- }
+ }
}
// Generate the report