diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2013-02-09 10:35:04 -0800 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2013-02-09 10:35:04 -0800 |
| commit | 7613d886f98299c36d667908c52401bd07eef1e0 (patch) | |
| tree | a31c4425c6a18a2691b3bf33f86c6a0dcff27689 /modules/gallery/tests/Photo_Helper_Test.php | |
| parent | f4ecb7e65850ca0cac9f7d963c34f7cd20ee9446 (diff) | |
| parent | 0312d1b071bd4434ddb3f82888b0323da6bf3732 (diff) | |
Merge pull request #128 from shadlaws/fix_1994
#1994 - Make get_file_metadata throw an exception if photo or movie is unidentifiable/illegal.
Diffstat (limited to 'modules/gallery/tests/Photo_Helper_Test.php')
| -rw-r--r-- | modules/gallery/tests/Photo_Helper_Test.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/gallery/tests/Photo_Helper_Test.php b/modules/gallery/tests/Photo_Helper_Test.php index 5207a6db..79b5ccfd 100644 --- a/modules/gallery/tests/Photo_Helper_Test.php +++ b/modules/gallery/tests/Photo_Helper_Test.php @@ -40,8 +40,12 @@ class Photo_Helper_Test extends Gallery_Unit_Test_Case { } public function get_file_metadata_with_illegal_extension_test() { - $this->assert_equal(array(0, 0, null, null), - photo::get_file_metadata(MODPATH . "gallery/tests/Photo_Helper_Test.php")); + try { + $metadata = photo::get_file_metadata(MODPATH . "gallery/tests/Photo_Helper_Test.php"); + $this->assert_true(false, "Shouldn't get here"); + } catch (Exception $e) { + // pass + } } public function get_file_metadata_with_illegal_extension_but_valid_file_contents_test() { @@ -53,4 +57,14 @@ class Photo_Helper_Test extends Gallery_Unit_Test_Case { $this->assert_equal(array(1024, 768, "image/jpeg", "jpg"), photo::get_file_metadata(TMPPATH . "test_jpg_with_php_extension.php")); } + + public function get_file_metadata_with_valid_extension_but_illegal_file_contents_test() { + copy(MODPATH . "gallery/tests/Photo_Helper_Test.php", TMPPATH . "test_php_with_jpg_extension.jpg"); + try { + $metadata = photo::get_file_metadata(TMPPATH . "test_php_with_jpg_extension.jpg"); + $this->assert_true(false, "Shouldn't get here"); + } catch (Exception $e) { + // pass + } + } } |
