diff options
author | shadlaws <shad@shadlaws.com> | 2013-02-10 02:28:47 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-02-10 02:28:47 +0100 |
commit | bfdf5a00fd8a256c4b564887f4eb649cf9d34774 (patch) | |
tree | d36aba54d25d0ddd01d409386a0f73c63feedb0e /modules/gallery/tests | |
parent | a06faf61b40b458870bad5e66e2666c90032ee2d (diff) |
#2000 - Make legal_file::smash_extensions more robust.
- Fixed legal_file::smash_extensions.
- Added new unit test.
- Removed duplicated condition in existing unit test.
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r-- | modules/gallery/tests/Legal_File_Helper_Test.php | 10 |
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 |