summaryrefslogtreecommitdiff
path: root/core/tests/Photo_Helper_Test.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-16 22:20:16 +0000
committerBharat Mediratta <bharat@menalto.com>2009-05-16 22:20:16 +0000
commit6ceb10424b4dc1bba6cfc1bd3a17c4428ae9c98c (patch)
tree914822911f88037254a5a035591d413ba0b96865 /core/tests/Photo_Helper_Test.php
parentc3917aa250b6b7ee4c5534224cf5f31380679c25 (diff)
Don't allow albums/photos/movies to end in "." because it risks
securit issues (and so Kohana won't route them, see http://dev.kohanaphp.com/issues/684). Partial fix for ticket #248.
Diffstat (limited to 'core/tests/Photo_Helper_Test.php')
-rw-r--r--core/tests/Photo_Helper_Test.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/tests/Photo_Helper_Test.php b/core/tests/Photo_Helper_Test.php
index 81405b79..deb11bb9 100644
--- a/core/tests/Photo_Helper_Test.php
+++ b/core/tests/Photo_Helper_Test.php
@@ -85,8 +85,7 @@ class Photo_Helper_Test extends Unit_Test_Case {
$rand = rand();
$root = ORM::factory("item", 1);
try {
- $filename = DOCROOT . "core/tests/test.jpg";
- $photo = photo::create($root, $filename, "$rand/.jpg", $rand, $rand);
+ $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand/.jpg", $rand, $rand);
} catch (Exception $e) {
// pass
return;
@@ -94,4 +93,17 @@ class Photo_Helper_Test extends Unit_Test_Case {
$this->assert_true(false, "Shouldn't create a photo with / in the name");
}
+
+ public function create_photo_silently_trims_trailing_periods_test() {
+ $rand = rand();
+ $root = ORM::factory("item", 1);
+ try {
+ $photo = photo::create($root, DOCROOT . "core/tests/test.jpg", "$rand.jpg.", $rand, $rand);
+ } catch (Exception $e) {
+ $this->assert_equal("@todo NAME_CANNOT_END_IN_PERIOD", $e->getMessage());
+ return;
+ }
+
+ $this->assert_true(false, "Shouldn't create a photo with trailing . in the name");
+ }
}