\s*)$/', file_get_contents($file), $matches)) { $this->assert_true(false, "$file ends in a trailing ?>"); } } } public function view_files_end_in_html_dot_php_test() { $dir = new GalleryCodeFilterIterator( new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT))); foreach ($dir as $file) { if ($file->getFilename() == 'kohana_unit_test.php') { // Exception, this file must be named accordingly for the test framework continue; } if (preg_match("|/views\b|", $file->getPath())) { $this->assert_equal(".html.php", substr($file->getPathname(), -9), $file->getPathname()); } } } } class GalleryCodeFilterIterator extends FilterIterator { public function accept() { // Skip anything that we didn't write $path_name = $this->getInnerIterator()->getPathName(); return !(strstr($path_name, ".svn") || substr($path_name, -1, 1) == "~" || strstr($path_name, SYSPATH) !== false || strstr($path_name, MODPATH . 'forge') !== false || strstr($path_name, MODPATH . 'unit_test') !== false || strstr($path_name, MODPATH . 'mptt') !== false || strstr($path_name, DOCROOT . 'var') !== false || strstr($path_name, DOCROOT . 'test') !== false); } }