- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/SanitizeFileName.php
r48603 r48937 8 8 # r17990 9 9 $file_name = sanitize_file_name( 'test.phtml.txt' ); 10 $this->assert Equals( 'test.phtml_.txt', $file_name );10 $this->assertSame( 'test.phtml_.txt', $file_name ); 11 11 } 12 12 … … 18 18 } 19 19 $string .= 'test'; 20 $this->assert Equals( 'testtest', sanitize_file_name( $string ) );20 $this->assertSame( 'testtest', sanitize_file_name( $string ) ); 21 21 } 22 22 … … 27 27 $in = 'àáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ'; 28 28 $out = 'aaaaaaaeceeeeiiiinoooooouuuuyy'; 29 $this->assert Equals( $out, sanitize_file_name( $in ) );29 $this->assertSame( $out, sanitize_file_name( $in ) ); 30 30 } 31 31 … … 44 44 45 45 foreach ( $urls as $test => $expected ) { 46 $this->assert Equals( $expected, sanitize_file_name( $test ) );46 $this->assertSame( $expected, sanitize_file_name( $test ) ); 47 47 } 48 48 } 49 49 50 50 function test_replaces_any_number_of_hyphens_with_one_hyphen() { 51 $this->assert Equals( 'a-t-t', sanitize_file_name( 'a----t----t' ) );51 $this->assertSame( 'a-t-t', sanitize_file_name( 'a----t----t' ) ); 52 52 } 53 53 54 54 function test_trims_trailing_hyphens() { 55 $this->assert Equals( 'a-t-t', sanitize_file_name( 'a----t----t----' ) );55 $this->assertSame( 'a-t-t', sanitize_file_name( 'a----t----t----' ) ); 56 56 } 57 57 58 58 function test_replaces_any_amount_of_whitespace_with_one_hyphen() { 59 $this->assert Equals( 'a-t', sanitize_file_name( 'a t' ) );60 $this->assert Equals( 'a-t', sanitize_file_name( "a \n\n\nt" ) );59 $this->assertSame( 'a-t', sanitize_file_name( 'a t' ) ); 60 $this->assertSame( 'a-t', sanitize_file_name( "a \n\n\nt" ) ); 61 61 } 62 62 … … 65 65 */ 66 66 function test_replaces_percent_sign() { 67 $this->assert Equals( 'a22b.jpg', sanitize_file_name( 'a%22b.jpg' ) );67 $this->assertSame( 'a22b.jpg', sanitize_file_name( 'a%22b.jpg' ) ); 68 68 } 69 69 70 70 function test_replaces_unnamed_file_extensions() { 71 71 // Test filenames with both supported and unsupported extensions. 72 $this->assert Equals( 'unnamed-file.exe', sanitize_file_name( '_.exe' ) );73 $this->assert Equals( 'unnamed-file.jpg', sanitize_file_name( '_.jpg' ) );72 $this->assertSame( 'unnamed-file.exe', sanitize_file_name( '_.exe' ) ); 73 $this->assertSame( 'unnamed-file.jpg', sanitize_file_name( '_.jpg' ) ); 74 74 } 75 75 76 76 function test_replaces_unnamed_file_extensionless() { 77 77 // Test a filenames that becomes extensionless. 78 $this->assert Equals( 'no-extension', sanitize_file_name( '_.no-extension' ) );78 $this->assertSame( 'no-extension', sanitize_file_name( '_.no-extension' ) ); 79 79 } 80 80 … … 83 83 */ 84 84 function test_replaces_invalid_utf8_characters( $input, $expected ) { 85 $this->assert Equals( $expected, sanitize_file_name( $input ) );85 $this->assertSame( $expected, sanitize_file_name( $input ) ); 86 86 } 87 87
Note: See TracChangeset
for help on using the changeset viewer.