diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index 1bb2e44e..63bf29d3 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -25,7 +25,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT))); $count = 0; foreach ($dir as $file) { - if (preg_match("#(vendor|test)/#", $file)) continue; + if (preg_match("#(vendor|test|\.cache)/#", $file)) continue; $count++; if (!preg_match("|\.html\.php$|", $file->getPathname())) { @@ -59,7 +59,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { $dir = new GalleryCodeFilterIterator( new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT))); foreach ($dir as $file) { - if (preg_match("#(vendor|test)/#", $file)) { + if (preg_match("#(vendor|test|\.cache)/#", $file)) { continue; } elseif (preg_match("/\.(php|css|html|js)$/", $file)) { foreach (file($file) as $line) { @@ -190,7 +190,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { break; default: - if (preg_match("#(vendor|test)/#", $path)) { + if (preg_match("#(vendor|test|\.cache)/#", $path)) { # including unmodified 3rd party code } elseif (preg_match("/modules\/(autorotate|movie_resized)/", $path)) { # including unmodified 3rd party code @@ -214,7 +214,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { new RecursiveDirectoryIterator(DOCROOT)))); $errors = array(); foreach ($dir as $file) { - if (preg_match("#/vendor/#", $file)) continue; + if (preg_match("#/(vendor|\.cache)/#", $file)) continue; $file_as_string = file_get_contents($file); if (preg_match('/\t/', $file_as_string)) { @@ -337,7 +337,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT))); $errors = ""; foreach ($dir as $file) { - if (preg_match("#(vendor|test)/#", $file)) { + if (preg_match("#(vendor|test|\.cache)/#", $file)) { continue; } elseif (preg_match("/\.(php|css|html|js)$/", $file)) { foreach (file($file) as $line_num => $line) { diff --git a/modules/gallery/tests/Legal_File_Helper_Test.php b/modules/gallery/tests/Legal_File_Helper_Test.php index b83cf9c6..74f787ab 100644 --- a/modules/gallery/tests/Legal_File_Helper_Test.php +++ b/modules/gallery/tests/Legal_File_Helper_Test.php @@ -26,7 +26,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal(null, legal_file::get_photo_types_by_extension("php.jpg")); // invalid w/ . // No extension returns full array - $this->assert_equal(4, count(legal_file::get_photo_types_by_extension())); + $this->assert_equal(5, count(legal_file::get_photo_types_by_extension())); } public function get_movie_types_by_extension_test() { @@ -47,7 +47,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal(null, legal_file::get_types_by_extension("php.flv")); // invalid w/ . // No extension returns full array - $this->assert_equal(9, count(legal_file::get_types_by_extension())); + $this->assert_equal(10, count(legal_file::get_types_by_extension())); } public function get_photo_extensions_test() { @@ -58,7 +58,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal(false, legal_file::get_photo_extensions("php.jpg")); // invalid w/ . // No extension returns full array - $this->assert_equal(4, count(legal_file::get_photo_extensions())); + $this->assert_equal(5, count(legal_file::get_photo_extensions())); } public function get_movie_extensions_test() { @@ -79,17 +79,17 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal(false, legal_file::get_extensions("php.jpg")); // invalid w/ . // No extension returns full array - $this->assert_equal(9, count(legal_file::get_extensions())); + $this->assert_equal(10, count(legal_file::get_extensions())); } public function get_filters_test() { // All 9 extensions both uppercase and lowercase - $this->assert_equal(18, count(legal_file::get_filters())); + $this->assert_equal(20, count(legal_file::get_filters())); } public function get_photo_types_test() { // Note that this is one *less* than photo extensions since jpeg and jpg have the same mime. - $this->assert_equal(3, count(legal_file::get_photo_types())); + $this->assert_equal(4, count(legal_file::get_photo_types())); } public function get_movie_types_test() { @@ -184,8 +184,17 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case { } public function sanitize_filename_with_invalid_arguments_test() { - foreach (array("flv" => "photo", "jpg" => "movie", "php" => "photo", - null => "movie", "jpg" => "album", "jpg" => null) as $extension => $type) { + $types = array( + array("flv", "photo"), + array("jpg", "movie"), + array("php", "photo"), + array(null, "movie"), + array("jpg", "album"), + array("jpg", null), + ); + + foreach ($types as $ary) { + list($extension, $type) = $ary; try { legal_file::sanitize_filename("foo.jpg", $extension, $type); $this->assert_true(false, "Shouldn't get here");