Ticket #16226: 16226-tests.patch
File 16226-tests.patch, 1.5 KB (added by , 10 years ago) |
---|
-
tests/phpunit/tests/formatting/SanitizeFileName.php
11 11 } 12 12 13 13 function test_removes_special_chars() { 14 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));14 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0)); 15 15 $string = 'test'; 16 16 foreach ( $special_chars as $char ) 17 17 $string .= $char; … … 26 26 */ 27 27 function test_replace_spaces() { 28 28 $urls = array( 29 'unencoded space.png' 30 'encoded %20space.jpg'=> 'encoded-space.jpg',31 'plus+space.jpg' => 'plus-space.jpg',32 'multi %20 +space.png' => 'multi-space.png',29 'unencoded space.png' => 'unencoded-space.png', 30 'encoded-space.jpg' => 'encoded-space.jpg', 31 'plus+space.jpg' => 'plusspace.jpg', 32 'multi %20 +space.png' => 'multi-20-space.png', 33 33 ); 34 34 35 35 foreach( $urls as $test => $expected ) { … … 49 49 $this->assertEquals("a-t", sanitize_file_name("a t")); 50 50 $this->assertEquals("a-t", sanitize_file_name("a \n\n\nt")); 51 51 } 52 53 function test_replaces_percent_sign() { 54 $this->assertEquals("a22b.jpg", sanitize_file_name("a%22b.jpg")); 55 } 52 56 }