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/Item_Model_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/Item_Model_Test.php')
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index a1c5bce6..a93498dd 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -445,13 +445,25 @@ class Item_Model_Test extends Gallery_Unit_Test_Case { $photo->set_data_file(MODPATH . "gallery/tests/Item_Model_Test.php"); $photo->save(); } catch (ORM_Validation_Exception $e) { - $this->assert_same(array("mime_type" => "invalid", "name" => "illegal_data_file_extension"), - $e->validation->errors()); + $this->assert_same(array("name" => "illegal_data_file_extension"), $e->validation->errors()); return; // pass } $this->assert_true(false, "Shouldn't get here"); } + public function unsafe_data_file_replacement_with_valid_extension_test() { + $temp_file = TMPPATH . "masquerading_php.jpg"; + copy(MODPATH . "gallery/tests/Item_Model_Test.php", $temp_file); + try { + $photo = test::random_photo(); + $photo->set_data_file($temp_file); + $photo->save(); + } catch (ORM_Validation_Exception $e) { + $this->assert_same(array("name" => "invalid_data_file"), $e->validation->errors()); + return; // pass + } + } + public function urls_test() { $photo = test::random_photo(); $this->assert_true( |