summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-17 23:04:03 +0000
committerBharat Mediratta <bharat@menalto.com>2009-05-17 23:04:03 +0000
commit7f4bcb540fb4ee4ded9f4a4103112f36046cce5d (patch)
treeb97a04fd1752c777127f764f48d8cdc1675eb108 /core
parentda9c170ba7ad286808f2eb0d975c4a0c10b68107 (diff)
Update preamble test to list all broken files at once
Diffstat (limited to 'core')
-rw-r--r--core/tests/File_Structure_Test.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/tests/File_Structure_Test.php b/core/tests/File_Structure_Test.php
index 6b2090d0..b7570290 100644
--- a/core/tests/File_Structure_Test.php
+++ b/core/tests/File_Structure_Test.php
@@ -59,16 +59,17 @@ class File_Structure_Test extends Unit_Test_Case {
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
$expected = $this->_get_preamble(__FILE__);
+ $errors = array();
foreach ($dir as $file) {
if (preg_match("/views/", $file->getPathname()) ||
$file->getPathName() == DOCROOT . "installer/database_config.php" ||
$file->getPathName() == DOCROOT . "installer/init_var.php") {
// The preamble for views is a single line that prevents direct script access
$lines = file($file->getPathname());
- $this->assert_equal(
- "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n",
- $lines[0],
- "in file: {$file->getPathname()}");
+ $view_expected = "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n";
+ if ($view_expected != $lines[0]) {
+ $errors[] = "{$file->getPathName()} line 1 expected $view_expected";
+ }
} else if (preg_match("|\.php$|", $file->getPathname())) {
$actual = $this->_get_preamble($file->getPathname());
if ($file->getPathName() == DOCROOT . "index.php" ||
@@ -76,14 +77,22 @@ class File_Structure_Test extends Unit_Test_Case {
// index.php and installer/index.php allow direct access; modify our expectations for them
$index_expected = $expected;
$index_expected[0] = "<?php";
- $this->assert_equal($index_expected, $actual, "in file: {$file->getPathname()}");
+ if ($index_expected != $actual) {
+ $errors[] = "{$file->getPathName()} line 1 expected $index_expected";
+ }
} else {
// We expect the full preamble in regular PHP files
$actual = $this->_get_preamble($file->getPathname());
- $this->assert_equal($expected, $actual, "in file: {$file->getPathname()}");
+ if ($expected != $actual) {
+ $errors[] = "{$file->getPathName()} line 1 expected $expected";
+ }
}
}
}
+
+ if ($errors) {
+ $this->assert_false(true, "Preamble errors:\n" . join("\n", $errors));
+ }
}
public function no_tabs_in_our_code_test() {