summaryrefslogtreecommitdiff
path: root/modules/gallery/tests/File_Structure_Test.php
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-08-30 07:42:37 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-08-30 07:42:37 -0700
commitb5813f92c7a73e11d47d1943c217fdf6b7e41de9 (patch)
treee760024d0bd69b9aa5b630643de2b8716260b31e /modules/gallery/tests/File_Structure_Test.php
parent22aa0b3092458d6de77837be45721f2722b8d5e0 (diff)
Improve no_tabs test to print out a complete list of files + line numbers + line snippet.
Diffstat (limited to 'modules/gallery/tests/File_Structure_Test.php')
-rw-r--r--modules/gallery/tests/File_Structure_Test.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 8a97e00b..9018f4c6 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -177,10 +177,20 @@ class File_Structure_Test extends Unit_Test_Case {
new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(DOCROOT))));
+ $errors = array();
foreach ($dir as $file) {
- $this->assert_false(
- preg_match('/\t/', file_get_contents($file)),
- "{$file->getPathname()} has tabs in it");
+ $file_as_string = file_get_contents($file);
+ if (preg_match('/\t/', $file_as_string)) {
+ foreach (split("\n", $file_as_string) as $l => $line) {
+ if (preg_match('/\t/', $line)) {
+ $errors[] = "$file:$l has tab(s) ($line)";
+ }
+ }
+ }
+ $file_as_string = null;
+ }
+ if ($errors) {
+ $this->assert_false(true, "tab(s) found:\n" . join("\n", $errors));
}
}