Assert how many files we analyze so that we can tell if we're suddenly

analzying too many or too few.
This commit is contained in:
Bharat Mediratta
2010-06-20 09:36:56 -07:00
parent 9f9d3866e8
commit ec052d7130

View File

@@ -23,13 +23,18 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
public function no_trailing_closing_php_tag_test() {
$dir = new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
$count = 0;
foreach ($dir as $file) {
$count++;
if (!preg_match("|\.html\.php$|", $file->getPathname())) {
$this->assert_false(
preg_match('/\?\>\s*$/', file_get_contents($file)),
"{$file->getPathname()} ends in ?>");
}
}
$this->assert_true($count > 500, "We should have analyzed at least this 500 files");
$this->assert_true($count < 1000, "We shouldn't be shipping 1000 files!");
}
public function view_files_correct_suffix_test() {