Make WordPress Core


Ignore:
Timestamp:
06/21/2016 02:55:29 PM (8 years ago)
Author:
joemcgill
Message:

Media: Improve handling of extensionless filenames.

Merge of [37756] to the 4.2 branch.

See #37111.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/tests/phpunit/tests/formatting/SanitizeFileName.php

    r29290 r37816  
    5050        $this->assertEquals("a-t", sanitize_file_name("a    \n\n\nt"));
    5151    }
     52
     53    function test_replaces_unnammed_file_extensions() {
     54        // Test filenames with both supported and unsupported extensions.
     55        $this->assertEquals( 'unnamed-file.exe', sanitize_file_name( '_.exe' ) );
     56        $this->assertEquals( 'unnamed-file.jpg', sanitize_file_name( '_.jpg' ) );
     57    }
     58
     59    function test_replaces_unnammed_file_extensionless() {
     60        // Test a filenames that becomes extensionless.
     61        $this->assertEquals( 'no-extension', sanitize_file_name( '_.no-extension' ) );
     62    }
    5263}
Note: See TracChangeset for help on using the changeset viewer.