mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-05 14:40:44 -04:00
#1943 - Make legal_file::change_extension more robust.
Previously would fail with dots in the directory but no extension. Added unit tests to verify the new change works.
This commit is contained in:
@@ -36,6 +36,24 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
|
||||
legal_file::change_extension("/website/foo.com/VID_20120513_105421.mp4", "jpg"));
|
||||
}
|
||||
|
||||
public function change_extension_path_containing_dots_and_no_extension_test() {
|
||||
$this->assert_equal(
|
||||
"/website/foo.com/VID_20120513_105421.jpg",
|
||||
legal_file::change_extension("/website/foo.com/VID_20120513_105421", "jpg"));
|
||||
}
|
||||
|
||||
public function change_extension_path_containing_dots_and_dot_extension_test() {
|
||||
$this->assert_equal(
|
||||
"/website/foo.com/VID_20120513_105421.jpg",
|
||||
legal_file::change_extension("/website/foo.com/VID_20120513_105421.", "jpg"));
|
||||
}
|
||||
|
||||
public function change_extension_path_containing_dots_and_non_standard_chars_test() {
|
||||
$this->assert_equal(
|
||||
"/j'écris@un#nom/bizarre(mais quand.même/ça_passe.jpg",
|
||||
legal_file::change_extension("/j'écris@un#nom/bizarre(mais quand.même/ça_passe.\$ÇÀ@€#_", "jpg"));
|
||||
}
|
||||
|
||||
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"));
|
||||
|
||||
Reference in New Issue
Block a user