summaryrefslogtreecommitdiff
path: root/modules/gallery/tests/Legal_File_Helper_Test.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-02-10 21:42:24 -0800
committerBharat Mediratta <bharat@menalto.com>2013-02-10 21:42:24 -0800
commitbb7590152d03385ad2e742e86c35162fcd556993 (patch)
treea1c1691c6035411827dbcc11e26140fe21c5577a /modules/gallery/tests/Legal_File_Helper_Test.php
parent9c363abc419039eaf5bb40cce90c3f5bde9d4e76 (diff)
parentbfdf5a00fd8a256c4b564887f4eb649cf9d34774 (diff)
Merge pull request #132 from shadlaws/fix_2000
#2000 - Make legal_file::smash_extensions more robust.
Diffstat (limited to 'modules/gallery/tests/Legal_File_Helper_Test.php')
-rw-r--r--modules/gallery/tests/Legal_File_Helper_Test.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/tests/Legal_File_Helper_Test.php b/modules/gallery/tests/Legal_File_Helper_Test.php
index 84a29a52..203d5616 100644
--- a/modules/gallery/tests/Legal_File_Helper_Test.php
+++ b/modules/gallery/tests/Legal_File_Helper_Test.php
@@ -136,10 +136,18 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
public function smash_extensions_test() {
$this->assert_equal("foo_bar.jpg", legal_file::smash_extensions("foo.bar.jpg"));
$this->assert_equal("foo_bar_baz.jpg", legal_file::smash_extensions("foo.bar.baz.jpg"));
- $this->assert_equal("foo_bar_baz.jpg", legal_file::smash_extensions("foo.bar.baz.jpg"));
$this->assert_equal("foo_bar_baz.jpg", legal_file::smash_extensions("...foo...bar..baz...jpg"));
$this->assert_equal("/path/to/foo_bar.jpg", legal_file::smash_extensions("/path/to/foo.bar.jpg"));
$this->assert_equal("/path/to.to/foo_bar.jpg", legal_file::smash_extensions("/path/to.to/foo.bar.jpg"));
$this->assert_equal("foo_bar-12345678.jpg", legal_file::smash_extensions("foo.bar-12345678.jpg"));
}
+
+ public function smash_extensions_pass_thru_names_without_extensions_test() {
+ $this->assert_equal("foo", legal_file::smash_extensions("foo"));
+ $this->assert_equal("foo.", legal_file::smash_extensions("foo."));
+ $this->assert_equal(".foo", legal_file::smash_extensions(".foo"));
+ $this->assert_equal(".", legal_file::smash_extensions("."));
+ $this->assert_equal("", legal_file::smash_extensions(""));
+ $this->assert_equal(null, legal_file::smash_extensions(null));
+ }
} \ No newline at end of file