summaryrefslogtreecommitdiff
path: root/core/tests/File_Structure_Test.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-01 22:05:08 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-01 22:05:08 +0000
commit6f98bd445ad53f08810e3861db8a064d71d81baf (patch)
treeffddcb00d69e61f9b978ac00059f2f0d9ff364ad /core/tests/File_Structure_Test.php
parenta7f22994ed0298ed051235e90bb581703956ba30 (diff)
Clean up tests a bit.
Diffstat (limited to 'core/tests/File_Structure_Test.php')
-rw-r--r--core/tests/File_Structure_Test.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/tests/File_Structure_Test.php b/core/tests/File_Structure_Test.php
index 23d6acbb..c4f8bc01 100644
--- a/core/tests/File_Structure_Test.php
+++ b/core/tests/File_Structure_Test.php
@@ -22,10 +22,11 @@ class File_Structure_Test extends Unit_Test_Case {
public function no_trailing_closing_php_tag_test() {
$dir = new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
+ $incorrect = array();
foreach ($dir as $file) {
- if (preg_match('/(\?\>\s*)$/', file_get_contents($file), $matches)) {
- $this->assert_true(false, "$file ends in a trailing ?>");
- }
+ $this->assert_false(
+ preg_match('/\?\>\s*$/', file_get_contents($file)),
+ "{$file->getPathname()} ends in ?>");
}
}
@@ -34,12 +35,12 @@ class File_Structure_Test extends Unit_Test_Case {
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
+ // 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());
- }
+ $this->assert_false(
+ preg_match("|/views/.*?(?<!\.html)\.php|", $file->getPathname()),
+ "{$file->getPathname()} should end in .html.php");
}
}
}