Skip to content

Commit

Permalink
Assert how many files we analyze so that we can tell if we're suddenly
Browse files Browse the repository at this point in the history
analzying too many or too few.
  • Loading branch information
bharat committed Jun 20, 2010
1 parent 9f9d386 commit ec052d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/gallery/tests/File_Structure_Test.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
public function no_trailing_closing_php_tag_test() { public function no_trailing_closing_php_tag_test() {
$dir = new GalleryCodeFilterIterator( $dir = new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT))); new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
$count = 0;
foreach ($dir as $file) { foreach ($dir as $file) {
$count++;
if (!preg_match("|\.html\.php$|", $file->getPathname())) { if (!preg_match("|\.html\.php$|", $file->getPathname())) {
$this->assert_false( $this->assert_false(
preg_match('/\?\>\s*$/', file_get_contents($file)), preg_match('/\?\>\s*$/', file_get_contents($file)),
"{$file->getPathname()} ends in ?>"); "{$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() { public function view_files_correct_suffix_test() {
Expand Down

0 comments on commit ec052d7

Please sign in to comment.