WordPress.org

Make WordPress Core

Ticket #43170: 43170-tests-factory-attachments.patch

File 43170-tests-factory-attachments.patch, 1020 bytes (added by Viper007Bond, 23 months ago)

Allow for multibyte filenames in attachment unit tests.

  • tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    3535
    3636        function create_upload_object( $file, $parent = 0 ) {
    3737                $contents = file_get_contents( $file );
    38                 $upload   = wp_upload_bits( basename( $file ), null, $contents );
     38                $upload   = wp_upload_bits( wp_basename( $file ), null, $contents );
    3939
    4040                $type = '';
    4141                if ( ! empty( $upload['type'] ) ) {
     
    4848                }
    4949
    5050                $attachment = array(
    51                         'post_title'     => basename( $upload['file'] ),
     51                        'post_title'     => wp_basename( $upload['file'] ),
    5252                        'post_content'   => '',
    5353                        'post_type'      => 'attachment',
    5454                        'post_parent'    => $parent,