Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (9 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r42011 r42343  
    66class Tests_Functions extends WP_UnitTestCase {
    77        function test_wp_parse_args_object() {
    8                 $x = new MockClass;
     8                $x        = new MockClass;
    99                $x->_baba = 5;
    10                 $x->yZ = "baba";
    11                 $x->a = array(5, 111, 'x');
    12                 $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x));
     10                $x->yZ    = 'baba';
     11                $x->a     = array( 5, 111, 'x' );
     12                $this->assertEquals(
     13                        array(
     14                                '_baba' => 5,
     15                                'yZ'    => 'baba',
     16                                'a'     => array( 5, 111, 'x' ),
     17                        ), wp_parse_args( $x )
     18                );
    1319                $y = new MockClass;
    14                 $this->assertEquals(array(), wp_parse_args($y));
    15         }
    16 
    17         function test_wp_parse_args_array()  {
     20                $this->assertEquals( array(), wp_parse_args( $y ) );
     21        }
     22
     23        function test_wp_parse_args_array() {
    1824                // arrays
    1925                $a = array();
    20                 $this->assertEquals(array(), wp_parse_args($a));
    21                 $b = array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x'));
    22                 $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($b));
     26                $this->assertEquals( array(), wp_parse_args( $a ) );
     27                $b = array(
     28                        '_baba' => 5,
     29                        'yZ'    => 'baba',
     30                        'a'     => array( 5, 111, 'x' ),
     31                );
     32                $this->assertEquals(
     33                        array(
     34                                '_baba' => 5,
     35                                'yZ'    => 'baba',
     36                                'a'     => array( 5, 111, 'x' ),
     37                        ), wp_parse_args( $b )
     38                );
    2339        }
    2440
    2541        function test_wp_parse_args_defaults() {
    26                 $x = new MockClass;
     42                $x        = new MockClass;
    2743                $x->_baba = 5;
    28                 $x->yZ = "baba";
    29                 $x->a = array(5, 111, 'x');
    30                 $d = array('pu' => 'bu');
    31                 $this->assertEquals(array('pu' => 'bu', '_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $d));
    32                 $e = array('_baba' => 6);
    33                 $this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $e));
     44                $x->yZ    = 'baba';
     45                $x->a     = array( 5, 111, 'x' );
     46                $d        = array( 'pu' => 'bu' );
     47                $this->assertEquals(
     48                        array(
     49                                'pu'    => 'bu',
     50                                '_baba' => 5,
     51                                'yZ'    => 'baba',
     52                                'a'     => array( 5, 111, 'x' ),
     53                        ), wp_parse_args( $x, $d )
     54                );
     55                $e = array( '_baba' => 6 );
     56                $this->assertEquals(
     57                        array(
     58                                '_baba' => 5,
     59                                'yZ'    => 'baba',
     60                                'a'     => array( 5, 111, 'x' ),
     61                        ), wp_parse_args( $x, $e )
     62                );
    3463        }
    3564
    3665        function test_wp_parse_args_other() {
    3766                $b = true;
    38                 wp_parse_str($b, $s);
    39                 $this->assertEquals($s, wp_parse_args($b));
     67                wp_parse_str( $b, $s );
     68                $this->assertEquals( $s, wp_parse_args( $b ) );
    4069                $q = 'x=5&_baba=dudu&';
    41                 wp_parse_str($q, $ss);
    42                 $this->assertEquals($ss, wp_parse_args($q));
     70                wp_parse_str( $q, $ss );
     71                $this->assertEquals( $ss, wp_parse_args( $q ) );
    4372        }
    4473
     
    73102                        'C:\\WINDOWS',
    74103                        '\\\\sambashare\\foo',
    75                         );
    76                 foreach ($absolute_paths as $path)
    77                         $this->assertTrue( path_is_absolute($path), "path_is_absolute('$path') should return true" );
     104                );
     105                foreach ( $absolute_paths as $path ) {
     106                        $this->assertTrue( path_is_absolute( $path ), "path_is_absolute('$path') should return true" );
     107                }
    78108        }
    79109
     
    90120                        'FOO',
    91121                        '..\\WINDOWS',
    92                         );
    93                 foreach ($relative_paths as $path)
    94                         $this->assertFalse( path_is_absolute($path), "path_is_absolute('$path') should return false" );
     122                );
     123                foreach ( $relative_paths as $path ) {
     124                        $this->assertFalse( path_is_absolute( $path ), "path_is_absolute('$path') should return false" );
     125                }
    95126        }
    96127
     
    142173
    143174                // check with single quotes in name (somehow)
    144                 $this->assertEquals( "abcdefgh.png", wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' );
     175                $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' );
    145176
    146177                // check with single quotes in name (somehow)
    147                 $this->assertEquals( "abcdefgh.png", wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
     178                $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
    148179
    149180                // test crazy name (useful for regression tests)
     
    158189        function test_is_serialized() {
    159190                $cases = array(
    160                         serialize(null),
    161                         serialize(true),
    162                         serialize(false),
    163                         serialize(-25),
    164                         serialize(25),
    165                         serialize(1.1),
    166                         serialize('this string will be serialized'),
    167                         serialize("a\nb"),
    168                         serialize(array()),
    169                         serialize(array(1,1,2,3,5,8,13)),
    170                         serialize( (object)array('test' => true, '3', 4) )
    171                 );
    172                 foreach ( $cases as $case )
    173                         $this->assertTrue( is_serialized($case), "Serialized data: $case" );
     191                        serialize( null ),
     192                        serialize( true ),
     193                        serialize( false ),
     194                        serialize( -25 ),
     195                        serialize( 25 ),
     196                        serialize( 1.1 ),
     197                        serialize( 'this string will be serialized' ),
     198                        serialize( "a\nb" ),
     199                        serialize( array() ),
     200                        serialize( array( 1, 1, 2, 3, 5, 8, 13 ) ),
     201                        serialize(
     202                                (object) array(
     203                                        'test' => true,
     204                                        '3',
     205                                        4,
     206                                )
     207                        ),
     208                );
     209                foreach ( $cases as $case ) {
     210                        $this->assertTrue( is_serialized( $case ), "Serialized data: $case" );
     211                }
    174212
    175213                $not_serialized = array(
    176214                        'a string',
    177215                        'garbage:a:0:garbage;',
    178                         's:4:test;'
    179                 );
    180                 foreach ( $not_serialized as $case )
    181                         $this->assertFalse( is_serialized($case), "Test data: $case" );
     216                        's:4:test;',
     217                );
     218                foreach ( $not_serialized as $case ) {
     219                        $this->assertFalse( is_serialized( $case ), "Test data: $case" );
     220                }
    182221        }
    183222
     
    255294                        $this->assertEquals( "$url?foo=1", add_query_arg( 'foo', '1', $url ) );
    256295                        $this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
    257                         $this->assertEquals( "$url?foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ), $url ) );
    258                         $this->assertEquals( "$url?foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ), $url ) );
     296                        $this->assertEquals(
     297                                "$url?foo=2", add_query_arg(
     298                                        array(
     299                                                'foo' => '1',
     300                                                'foo' => '2',
     301                                        ), $url
     302                                )
     303                        );
     304                        $this->assertEquals(
     305                                "$url?foo=1&bar=2", add_query_arg(
     306                                        array(
     307                                                'foo' => '1',
     308                                                'bar' => '2',
     309                                        ), $url
     310                                )
     311                        );
    259312
    260313                        $_SERVER['REQUEST_URI'] = $url;
     
    262315                        $this->assertEquals( "$url?foo=1", add_query_arg( 'foo', '1' ) );
    263316                        $this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ) ) );
    264                         $this->assertEquals( "$url?foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ) ) );
    265                         $this->assertEquals( "$url?foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ) ) );
     317                        $this->assertEquals(
     318                                "$url?foo=2", add_query_arg(
     319                                        array(
     320                                                'foo' => '1',
     321                                                'foo' => '2',
     322                                        )
     323                                )
     324                        );
     325                        $this->assertEquals(
     326                                "$url?foo=1&bar=2", add_query_arg(
     327                                        array(
     328                                                'foo' => '1',
     329                                                'bar' => '2',
     330                                        )
     331                                )
     332                        );
    266333                }
    267334
    268335                foreach ( $frag_urls as $frag_url ) {
    269336                        $_SERVER['REQUEST_URI'] = 'nothing';
    270                         $url = str_replace( '#frag', '', $frag_url );
     337                        $url                    = str_replace( '#frag', '', $frag_url );
    271338
    272339                        $this->assertEquals( "$url?foo=1#frag", add_query_arg( 'foo', '1', $frag_url ) );
    273340                        $this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ), $frag_url ) );
    274                         $this->assertEquals( "$url?foo=2#frag", add_query_arg( array( 'foo' => '1', 'foo' => '2' ), $frag_url ) );
    275                         $this->assertEquals( "$url?foo=1&bar=2#frag", add_query_arg( array( 'foo' => '1', 'bar' => '2' ), $frag_url ) );
     341                        $this->assertEquals(
     342                                "$url?foo=2#frag", add_query_arg(
     343                                        array(
     344                                                'foo' => '1',
     345                                                'foo' => '2',
     346                                        ), $frag_url
     347                                )
     348                        );
     349                        $this->assertEquals(
     350                                "$url?foo=1&bar=2#frag", add_query_arg(
     351                                        array(
     352                                                'foo' => '1',
     353                                                'bar' => '2',
     354                                        ), $frag_url
     355                                )
     356                        );
    276357
    277358                        $_SERVER['REQUEST_URI'] = $frag_url;
     
    279360                        $this->assertEquals( "$url?foo=1#frag", add_query_arg( 'foo', '1' ) );
    280361                        $this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ) ) );
    281                         $this->assertEquals( "$url?foo=2#frag", add_query_arg( array( 'foo' => '1', 'foo' => '2' ) ) );
    282                         $this->assertEquals( "$url?foo=1&bar=2#frag", add_query_arg( array( 'foo' => '1', 'bar' => '2' ) ) );
     362                        $this->assertEquals(
     363                                "$url?foo=2#frag", add_query_arg(
     364                                        array(
     365                                                'foo' => '1',
     366                                                'foo' => '2',
     367                                        )
     368                                )
     369                        );
     370                        $this->assertEquals(
     371                                "$url?foo=1&bar=2#frag", add_query_arg(
     372                                        array(
     373                                                'foo' => '1',
     374                                                'bar' => '2',
     375                                        )
     376                                )
     377                        );
    283378                }
    284379
     
    300395                        $this->assertEquals( "$url&foo=1", add_query_arg( 'foo', '1', $url ) );
    301396                        $this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
    302                         $this->assertEquals( "$url&foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ), $url ) );
    303                         $this->assertEquals( "$url&foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ), $url ) );
     397                        $this->assertEquals(
     398                                "$url&foo=2", add_query_arg(
     399                                        array(
     400                                                'foo' => '1',
     401                                                'foo' => '2',
     402                                        ), $url
     403                                )
     404                        );
     405                        $this->assertEquals(
     406                                "$url&foo=1&bar=2", add_query_arg(
     407                                        array(
     408                                                'foo' => '1',
     409                                                'bar' => '2',
     410                                        ), $url
     411                                )
     412                        );
    304413
    305414                        $_SERVER['REQUEST_URI'] = $url;
     
    307416                        $this->assertEquals( "$url&foo=1", add_query_arg( 'foo', '1' ) );
    308417                        $this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ) ) );
    309                         $this->assertEquals( "$url&foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ) ) );
    310                         $this->assertEquals( "$url&foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ) ) );
     418                        $this->assertEquals(
     419                                "$url&foo=2", add_query_arg(
     420                                        array(
     421                                                'foo' => '1',
     422                                                'foo' => '2',
     423                                        )
     424                                )
     425                        );
     426                        $this->assertEquals(
     427                                "$url&foo=1&bar=2", add_query_arg(
     428                                        array(
     429                                                'foo' => '1',
     430                                                'bar' => '2',
     431                                        )
     432                                )
     433                        );
    311434                }
    312435
     
    319442        function test_add_query_arg_numeric_keys() {
    320443                $url = add_query_arg( array( 'foo' => 'bar' ), '1=1' );
    321                 $this->assertEquals('1=1&foo=bar', $url);
    322 
    323                 $url = add_query_arg( array( 'foo' => 'bar', '1' => '2' ), '1=1' );
    324                 $this->assertEquals('1=2&foo=bar', $url);
     444                $this->assertEquals( '1=1&foo=bar', $url );
     445
     446                $url = add_query_arg(
     447                        array(
     448                                'foo' => 'bar',
     449                                '1'   => '2',
     450                        ), '1=1'
     451                );
     452                $this->assertEquals( '1=2&foo=bar', $url );
    325453
    326454                $url = add_query_arg( array( '1' => '2' ), 'foo=bar' );
    327                 $this->assertEquals('foo=bar&1=2', $url);
     455                $this->assertEquals( 'foo=bar&1=2', $url );
    328456        }
    329457
     
    387515
    388516                update_option( 'blog_charset', 'utf8' );
    389                 $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     517                $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
    390518
    391519                update_option( 'blog_charset', 'utf-8' );
    392                 $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     520                $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
    393521
    394522                update_option( 'blog_charset', 'UTF8' );
    395                 $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     523                $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
    396524
    397525                update_option( 'blog_charset', 'UTF-8' );
    398                 $this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
     526                $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
    399527
    400528                update_option( 'blog_charset', 'ISO-8859-1' );
    401                 $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     529                $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
    402530
    403531                update_option( 'blog_charset', 'ISO8859-1' );
    404                 $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     532                $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
    405533
    406534                update_option( 'blog_charset', 'iso8859-1' );
    407                 $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     535                $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
    408536
    409537                update_option( 'blog_charset', 'iso-8859-1' );
    410                 $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
     538                $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
    411539
    412540                // Arbitrary strings are passed through.
    413541                update_option( 'blog_charset', 'foobarbaz' );
    414                 $this->assertEquals( 'foobarbaz', get_option( 'blog_charset') );
     542                $this->assertEquals( 'foobarbaz', get_option( 'blog_charset' ) );
    415543
    416544                update_option( 'blog_charset', $orig_blog_charset );
     
    457585        function test_device_can_upload( $user_agent, $expected ) {
    458586                $_SERVER['HTTP_USER_AGENT'] = $user_agent;
    459                 $actual = _device_can_upload();
     587                $actual                     = _device_can_upload();
    460588                unset( $_SERVER['HTTP_USER_AGENT'] );
    461589                $this->assertEquals( $expected, $actual );
     
    572700                        'ftp://127.0.0.1/',
    573701                        'http://www.woo.com/video?v=exvUH2qKLTU',
    574                         'http://taco.com?burrito=enchilada#guac'
    575                 );
    576 
    577                 $blob ="
     702                        'http://taco.com?burrito=enchilada#guac',
     703                );
     704
     705                $blob = '
    578706                        http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html
    579707
     
    635763
    636764                        http://taco.com?burrito=enchilada#guac
    637                 ";
     765                ';
    638766
    639767                $urls = wp_extract_urls( $blob );
     
    650778                $this->assertEquals( $original_urls, $decoded );
    651779
    652                 $blob ="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
     780                $blob = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
    653781                        incididunt ut labore http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html et dolore magna aliqua.
    654782                        Ut http://this.com enim ad minim veniam, quis nostrud exercitation 16.06. to 18.06.2014 ullamco http://127.0.0.1
    655783                        laboris nisi ut aliquip ex http://www111.urwyeoweytwutreyytqytwetowteuiiu.com/?346236346326&2134362574863.437 ea
    656784                        commodo consequat. http://wordpress-core/1,2,3,4,5,6/-1-2-3-4-/woo.html Duis aute irure dolor in reprehenderit in voluptate
    657                         velit esse http://wordpress-core.com:8080/ cillum dolore eu fugiat nulla <A href=\"http://www.website.com:5000\">http://www.website.com:5000</B> pariatur. Excepteur sint occaecat cupidatat non proident,
    658                         sunt in culpa qui officia deserunt mollit http://wordpress-core/?346236346326&amp;2134362574863.437 anim id est laborum.";
     785                        velit esse http://wordpress-core.com:8080/ cillum dolore eu fugiat nulla <A href="http://www.website.com:5000">http://www.website.com:5000</B> pariatur. Excepteur sint occaecat cupidatat non proident,
     786                        sunt in culpa qui officia deserunt mollit http://wordpress-core/?346236346326&amp;2134362574863.437 anim id est laborum.';
    659787
    660788                $urls = wp_extract_urls( $blob );
     
    708836
    709837                $eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
    710                 $utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
     838                $utf8  = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
    711839
    712840                $this->assertEquals( 'aあb', $utf8 );
     
    732860
    733861                $eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
    734                 $utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
     862                $utf8  = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
    735863
    736864                $this->assertEquals( 'aあb', $utf8 );
     
    752880         */
    753881        function test_wp_json_encode_object() {
    754                 $object = new stdClass;
     882                $object    = new stdClass;
    755883                $object->a = 'b';
    756884                $this->assertEquals( wp_json_encode( $object ), '{"a":"b"}' );
     
    783911                $this->assertEquals( '', $actual );
    784912
    785                 $GLOBALS['post']        = self::factory()->post->create_and_get( array(
    786                         'post_date' => '2015-09-16 08:00:00'
    787                 ) );
     913                $GLOBALS['post'] = self::factory()->post->create_and_get(
     914                        array(
     915                                'post_date' => '2015-09-16 08:00:00',
     916                        )
     917                );
    788918
    789919                ob_start();
     
    831961                        array( '2016-03-02T19:13:00', '2016-03-02 19:13' ),
    832962                        array( '2016-03-02T19:13:00', '16-03-02 19:13' ),
    833                         array( '2016-03-02T19:13:00', '16-03-02 19:13' )
     963                        array( '2016-03-02T19:13:00', '16-03-02 19:13' ),
    834964                );
    835965        }
     
    8841014
    8851015                $ini_limit_before = ini_get( 'memory_limit' );
    886                 $raised_limit = wp_raise_memory_limit();
    887                 $ini_limit_after = ini_get( 'memory_limit' );
     1016                $raised_limit     = wp_raise_memory_limit();
     1017                $ini_limit_after  = ini_get( 'memory_limit' );
    8881018
    8891019                $this->assertSame( $ini_limit_before, $ini_limit_after );
     
    9931123                }
    9941124
    995                 $file = DIR_TESTDATA . '/uploads/video-play.svg';
     1125                $file     = DIR_TESTDATA . '/uploads/video-play.svg';
    9961126                $filename = 'video-play.svg';
    9971127
    9981128                $expected = array(
    999                         'ext' => 'svg',
    1000                         'type' => 'image/svg+xml',
     1129                        'ext'             => 'svg',
     1130                        'type'            => 'image/svg+xml',
    10011131                        'proper_filename' => false,
    10021132                );
     
    10181148                }
    10191149
    1020                 $file = DIR_TESTDATA . '/uploads/dashicons.woff';
     1150                $file     = DIR_TESTDATA . '/uploads/dashicons.woff';
    10211151                $filename = 'dashicons.woff';
    10221152
    10231153                $expected = array(
    1024                         'ext' => 'woff',
    1025                         'type' => 'application/font-woff',
     1154                        'ext'             => 'woff',
     1155                        'type'            => 'application/font-woff',
    10261156                        'proper_filename' => false,
    10271157                );
     
    10861216                                'canola.jpg',
    10871217                                array(
    1088                                         'ext' => 'jpg',
    1089                                         'type' => 'image/jpeg',
     1218                                        'ext'             => 'jpg',
     1219                                        'type'            => 'image/jpeg',
    10901220                                        'proper_filename' => false,
    10911221                                ),
     
    10961226                                'test-image-mime-jpg.png',
    10971227                                array(
    1098                                         'ext' => 'jpg',
    1099                                         'type' => 'image/jpeg',
     1228                                        'ext'             => 'jpg',
     1229                                        'type'            => 'image/jpeg',
    11001230                                        'proper_filename' => 'test-image-mime-jpg.jpg',
    11011231                                ),
     
    11061236                                'test-image-no-extension',
    11071237                                array(
    1108                                         'ext' => false,
    1109                                         'type' => false,
     1238                                        'ext'             => false,
     1239                                        'type'            => false,
    11101240                                        'proper_filename' => false,
    11111241                                ),
     
    11161246                                'big5.jpg',
    11171247                                array(
    1118                                         'ext' => 'jpg',
    1119                                         'type' => 'image/jpeg',
     1248                                        'ext'             => 'jpg',
     1249                                        'type'            => 'image/jpeg',
    11201250                                        'proper_filename' => false,
    11211251                                ),
     
    11261256                                'crazy-cdata.xml',
    11271257                                array(
    1128                                         'ext' => false,
    1129                                         'type' => false,
     1258                                        'ext'             => false,
     1259                                        'type'            => false,
    11301260                                        'proper_filename' => false,
    11311261                                ),
     
    11351265                // Test a few additional file types on single sites.
    11361266                if ( ! is_multisite() ) {
    1137                         $data = array_merge( $data, array(
    1138                                 // Standard non-image file.
    1139                                 array(
    1140                                         DIR_TESTDATA . '/formatting/big5.txt',
    1141                                         'big5.txt',
     1267                        $data = array_merge(
     1268                                $data, array(
     1269                                        // Standard non-image file.
     1270                                         array(
     1271                                                 DIR_TESTDATA . '/formatting/big5.txt',
     1272                                                 'big5.txt',
     1273                                                 array(
     1274                                                         'ext'             => 'txt',
     1275                                                         'type'            => 'text/plain',
     1276                                                         'proper_filename' => false,
     1277                                                 ),
     1278                                         ),
     1279                                        // Non-image file with wrong sub-type.
    11421280                                        array(
    1143                                                 'ext' => 'txt',
    1144                                                 'type' => 'text/plain',
    1145                                                 'proper_filename' => false,
     1281                                                DIR_TESTDATA . '/uploads/pages-to-word.docx',
     1282                                                'pages-to-word.docx',
     1283                                                array(
     1284                                                        'ext'             => 'docx',
     1285                                                        'type'            => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
     1286                                                        'proper_filename' => false,
     1287                                                ),
    11461288                                        ),
    1147                                 ),
    1148                                 // Non-image file with wrong sub-type.
    1149                                 array(
    1150                                         DIR_TESTDATA . '/uploads/pages-to-word.docx',
    1151                                         'pages-to-word.docx',
    1152                                         array(
    1153                                                 'ext' => 'docx',
    1154                                                 'type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    1155                                                 'proper_filename' => false,
    1156                                         ),
    1157                                 ),
    1158                         ) );
     1289                                )
     1290                        );
    11591291                }
    11601292
Note: See TracChangeset for help on using the changeset viewer.