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/xmlrpc/wp/newTerm.php

    r40916 r42343  
    99
    1010        public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    11                 self::$parent_term_id = $factory->term->create( array(
    12                         'taxonomy' => 'category',
    13                 ) );
     11                self::$parent_term_id = $factory->term->create(
     12                        array(
     13                                'taxonomy' => 'category',
     14                        )
     15                );
    1416        }
    1517
     
    5052                $this->make_user_by_role( 'editor' );
    5153
    52                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) );
     54                $result = $this->myxmlrpcserver->wp_newTerm(
     55                        array(
     56                                1,
     57                                'editor',
     58                                'editor',
     59                                array(
     60                                        'taxonomy' => 'category',
     61                                        'name'     => '',
     62                                ),
     63                        )
     64                );
    5365                $this->assertIXRError( $result );
    5466                $this->assertEquals( 403, $result->code );
     
    5971                $this->make_user_by_role( 'editor' );
    6072
    61                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) );
     73                $result = $this->myxmlrpcserver->wp_newTerm(
     74                        array(
     75                                1,
     76                                'editor',
     77                                'editor',
     78                                array(
     79                                        'taxonomy' => 'post_tag',
     80                                        'parent'   => self::$parent_term_id,
     81                                        'name'     => 'test',
     82                                ),
     83                        )
     84                );
    6285                $this->assertIXRError( $result );
    6386                $this->assertEquals( 403, $result->code );
     
    6891                $this->make_user_by_role( 'editor' );
    6992
    70                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
     93                $result = $this->myxmlrpcserver->wp_newTerm(
     94                        array(
     95                                1,
     96                                'editor',
     97                                'editor',
     98                                array(
     99                                        'taxonomy' => 'category',
     100                                        'parent'   => 'dasda',
     101                                        'name'     => 'test',
     102                                ),
     103                        )
     104                );
    71105                $this->assertIXRError( $result );
    72106                $this->assertEquals( 500, $result->code );
     
    76110                $this->make_user_by_role( 'editor' );
    77111
    78                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
     112                $result = $this->myxmlrpcserver->wp_newTerm(
     113                        array(
     114                                1,
     115                                'editor',
     116                                'editor',
     117                                array(
     118                                        'taxonomy' => 'category',
     119                                        'parent'   => 9999,
     120                                        'name'     => 'test',
     121                                ),
     122                        )
     123                );
    79124                $this->assertIXRError( $result );
    80125                $this->assertEquals( 403, $result->code );
     
    86131                $this->make_user_by_role( 'editor' );
    87132
    88                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) );
     133                $result = $this->myxmlrpcserver->wp_newTerm(
     134                        array(
     135                                1,
     136                                'editor',
     137                                'editor',
     138                                array(
     139                                        'taxonomy' => 'category',
     140                                        'name'     => 'test',
     141                                ),
     142                        )
     143                );
    89144                $this->assertNotIXRError( $result );
    90145                $this->assertStringMatchesFormat( '%d', $result );
     
    94149                $this->make_user_by_role( 'editor' );
    95150
    96                 $result  = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) );
     151                $result = $this->myxmlrpcserver->wp_newTerm(
     152                        array(
     153                                1,
     154                                'editor',
     155                                'editor',
     156                                array(
     157                                        'taxonomy' => 'category',
     158                                        'parent'   => self::$parent_term_id,
     159                                        'name'     => 'test',
     160                                ),
     161                        )
     162                );
    97163                $this->assertNotIXRError( $result );
    98164                $this->assertStringMatchesFormat( '%d', $result );
     
    102168                $this->make_user_by_role( 'editor' );
    103169
    104                 $taxonomy = array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );
    105                 $result  = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
     170                $taxonomy = array(
     171                        'taxonomy'    => 'category',
     172                        'parent'      => self::$parent_term_id,
     173                        'name'        => 'test_all',
     174                        'description' => 'Test all',
     175                        'slug'        => 'test_all',
     176                );
     177                $result   = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
    106178                $this->assertNotIXRError( $result );
    107179                $this->assertStringMatchesFormat( '%d', $result );
     
    113185        public function test_add_term_meta() {
    114186                $this->make_user_by_role( 'editor' );
    115                 $result = $this->myxmlrpcserver->wp_newTerm( array(
    116                         1,
    117                         'editor',
    118                         'editor',
    119                         array(
    120                                 'taxonomy' => 'category',
    121                                 'name' => 'Test meta',
    122                                 'custom_fields' => array(
    123                                         array(
    124                                                 'key' => 'key1',
    125                                                 'value' => 'value1',
     187                $result = $this->myxmlrpcserver->wp_newTerm(
     188                        array(
     189                                1,
     190                                'editor',
     191                                'editor',
     192                                array(
     193                                        'taxonomy'      => 'category',
     194                                        'name'          => 'Test meta',
     195                                        'custom_fields' => array(
     196                                                array(
     197                                                        'key'   => 'key1',
     198                                                        'value' => 'value1',
     199                                                ),
    126200                                        ),
    127201                                ),
    128                         ),
    129                 ) );
     202                        )
     203                );
    130204                $this->assertNotIXRError( $result );
    131205                $this->assertStringMatchesFormat( '%d', $result );
Note: See TracChangeset for help on using the changeset viewer.