Make WordPress Core

Changeset 45588


Ignore:
Timestamp:
07/02/2019 04:43:01 AM (7 years ago)
Author:
pento
Message:

Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in tests.

See #47632.

Location:
trunk/tests/phpunit
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r45486 r45588  
    707707                // from all over the place (globals, GET, etc), which makes it tricky
    708708                // to run them more than once without very carefully clearing everything
    709                 $_GET = $_POST = array();
     709                $_GET  = array();
     710                $_POST = array();
    710711                foreach ( array( 'query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow', 'current_screen' ) as $v ) {
    711712                        if ( isset( $GLOBALS[ $v ] ) ) {
  • trunk/tests/phpunit/includes/bootstrap.php

    r45445 r45588  
    7272define( 'REST_TESTS_IMPOSSIBLY_HIGH_NUMBER', 99999999 );
    7373
    74 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
     74$PHP_SELF            = '/index.php';
     75$GLOBALS['PHP_SELF'] = '/index.php';
     76$_SERVER['PHP_SELF'] = '/index.php';
    7577
    7678// Should we run in multisite mode?
  • trunk/tests/phpunit/includes/install.php

    r42343 r45588  
    2121tests_reset__SERVER();
    2222
    23 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
     23$PHP_SELF            = '/index.php';
     24$GLOBALS['PHP_SELF'] = '/index.php';
     25$_SERVER['PHP_SELF'] = '/index.php';
    2426
    2527tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' );
  • trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php

    r44701 r45588  
    267267         */
    268268        protected function renderFooter() {
    269                 if ( $hidden = $this->getHiddenCount( $this->slow ) ) {
     269                $hidden = $this->getHiddenCount( $this->slow );
     270                if ( $hidden ) {
    270271                        echo sprintf( '...and there %s %s more above your threshold hidden from view', $hidden == 1 ? 'is' : 'are', $hidden );
    271272                }
  • trunk/tests/phpunit/includes/testcase-canonical.php

    r44701 r45588  
    6262                        )
    6363                );
    64                 self::$post_ids[] = $post_id = $factory->post->create(
     64                $post_id          = $factory->post->create(
    6565                        array(
    6666                                'post_title' => 'post-format-test-gallery',
     
    6868                        )
    6969                );
    70                 self::$post_ids[] = $factory->post->create(
     70                self::$post_ids[] = $post_id;
     71                $factory->post->create(
    7172                        array(
    7273                                'import_id'   => 611,
     
    7677                        )
    7778                );
     79                self::$post_ids[] = $post_id;
    7880
    7981                self::$post_ids[] = $factory->post->create(
     
    8587                );
    8688
    87                 self::$post_ids[]  = $post_id = $factory->post->create(
     89                $post_id          = $factory->post->create(
    8890                        array(
    8991                                'import_id'  => 149,
     
    9294                        )
    9395                );
     96                self::$post_ids[]  = $post_id;
    9497                self::$comment_ids = $factory->comment->create_post_comments( $post_id, 15 );
    9598
     
    112115                        )
    113116                );
    114                 self::$post_ids[] = $post_id = $factory->post->create(
     117                $post_id          = $factory->post->create(
    115118                        array(
    116119                                'post_type'  => 'page',
     
    118121                        )
    119122                );
     123                self::$post_ids[] = $post_id;
    120124                self::$post_ids[] = $factory->post->create(
    121125                        array(
     
    127131                );
    128132
    129                 self::$post_ids[] = $parent_id = $factory->post->create(
     133                $parent_id        = $factory->post->create(
    130134                        array(
    131135                                'post_name' => 'parent',
     
    133137                        )
    134138                );
    135                 self::$post_ids[] = $child_id_1 = $factory->post->create(
     139                self::$post_ids[] = $parent_id;
     140                $child_id_1       = $factory->post->create(
    136141                        array(
    137142                                'post_name'   => 'child1',
     
    140145                        )
    141146                );
    142                 self::$post_ids[] = $child_id_2 = $factory->post->create(
     147                self::$post_ids[] = $child_id_1;
     148                $child_id_2       = $factory->post->create(
    143149                        array(
    144150                                'post_name'   => 'child2',
     
    147153                        )
    148154                );
    149                 self::$post_ids[] = $grandchild_id_1 = $factory->post->create(
     155                self::$post_ids[] = $child_id_2;
     156                $grandchild_id_1  = $factory->post->create(
    150157                        array(
    151158                                'post_name'   => 'grandchild',
     
    154161                        )
    155162                );
    156                 self::$post_ids[] = $grandchild_id_2 = $factory->post->create(
     163                self::$post_ids[] = $grandchild_id_1;
     164                $grandchild_id_2  = $factory->post->create(
    157165                        array(
    158166                                'post_name'   => 'grandchild',
     
    161169                        )
    162170                );
     171                self::$post_ids[] = $grandchild_id_2;
    163172
    164173                $cat1                             = $factory->term->create(
  • trunk/tests/phpunit/tests/admin/includesPlugin.php

    r42343 r45588  
    407407
    408408                        $files_to_move = array();
    409                         if ( $mu_plugins = opendir( WPMU_PLUGIN_DIR ) ) {
     409                        $mu_plugins    = opendir( WPMU_PLUGIN_DIR );
     410                        if ( $mu_plugins ) {
    410411                                while ( false !== $plugin = readdir( $mu_plugins ) ) {
    411412                                        if ( 0 !== strpos( $plugin, '.' ) ) {
     
    433434                $mu_bu_dir     = WP_CONTENT_DIR . '/mu-plugin-backup';
    434435                $files_to_move = array();
    435                 if ( is_dir( $mu_bu_dir ) && $mu_plugins = opendir( $mu_bu_dir ) ) {
     436                $mu_plugins    = @opendir( $mu_bu_dir );
     437                if ( $mu_plugins ) {
    436438                        while ( false !== $plugin = readdir( $mu_plugins ) ) {
    437439                                if ( 0 !== strpos( $plugin, '.' ) ) {
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r45424 r45588  
    1414
    1515        public static function wpSetUpBeforeClass( $factory ) {
    16                 self::$user_ids = self::$author_ids = $factory->user->create_many( 2, array( 'role' => 'author' ) );
    17 
    18                 self::$user_ids[] = self::$contributor_id = $factory->user->create( array( 'role' => 'contributor' ) );
    19                 self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
    20                 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
     16                self::$user_ids   = $factory->user->create_many( 2, array( 'role' => 'author' ) );
     17                self::$author_ids = self::$user_ids;
     18
     19                self::$contributor_id = $factory->user->create( array( 'role' => 'contributor' ) );
     20                self::$user_ids[]     = self::$contributor_id;
     21                self::$editor_id      = $factory->user->create( array( 'role' => 'editor' ) );
     22                self::$user_ids[]     = self::$editor_id;
     23                self::$admin_id       = $factory->user->create( array( 'role' => 'administrator' ) );
     24                self::$user_ids[]     = self::$admin_id;
    2125
    2226                self::$post_id = $factory->post->create();
  • trunk/tests/phpunit/tests/admin/includesScreen.php

    r45224 r45588  
    172172
    173173                foreach ( $this->core_screens as $hook_name => $screen ) {
    174                         $_GET              = $_POST = $_REQUEST = array();
    175                         $GLOBALS['taxnow'] = $GLOBALS['typenow'] = '';
    176                         $screen            = (object) $screen;
    177                         $hook              = parse_url( $hook_name );
     174                        $_GET               = array();
     175                        $_POST              = array();
     176                        $_REQUEST           = array();
     177                        $GLOBALS['taxnow']  = '';
     178                        $GLOBALS['typenow'] = '';
     179                        $screen             = (object) $screen;
     180                        $hook               = parse_url( $hook_name );
    178181
    179182                        if ( ! empty( $hook['query'] ) ) {
    180183                                $args = wp_parse_args( $hook['query'] );
    181184                                if ( isset( $args['taxonomy'] ) ) {
    182                                         $GLOBALS['taxnow'] = $_GET['taxonomy'] = $_POST['taxonomy'] = $_REQUEST['taxonomy'] = $args['taxonomy'];
     185                                        $GLOBALS['taxnow']    = $args['taxonomy'];
     186                                        $_GET['taxonomy']     = $args['taxonomy'];
     187                                        $_POST['taxonomy']    = $args['taxonomy'];
     188                                        $_REQUEST['taxonomy'] = $args['taxonomy'];
    183189                                }
    184190                                if ( isset( $args['post_type'] ) ) {
    185                                         $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $args['post_type'];
     191                                        $GLOBALS['typenow']    = $args['post_type'];
     192                                        $_GET['post_type']     = $args['post_type'];
     193                                        $_POST['post_type']    = $args['post_type'];
     194                                        $_REQUEST['post_type'] = $args['post_type'];
    186195                                } elseif ( isset( $screen->post_type ) ) {
    187                                         $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen->post_type;
     196                                        $GLOBALS['typenow']    = $screen->post_type;
     197                                        $_GET['post_type']     = $screen->post_type;
     198                                        $_POST['post_type']    = $screen->post_type;
     199                                        $_REQUEST['post_type'] = $screen->post_type;
    188200                                }
    189201                        }
     
    485497                register_post_type( 'type_shows_in_rest', array( 'show_in_rest' => true ) );
    486498
    487                 $GLOBALS['typenow']     = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = 'type_shows_in_rest';
     499                $GLOBALS['typenow']     = 'type_shows_in_rest';
     500                $_GET['post_type']      = 'type_shows_in_rest';
     501                $_POST['post_type']     = 'type_shows_in_rest';
     502                $_REQUEST['post_type']  = 'type_shows_in_rest';
    488503                $GLOBALS['hook_suffix'] = $hook;
    489504
  • trunk/tests/phpunit/tests/adminbar.php

    r43571 r45588  
    2222
    2323        public static function wpSetUpBeforeClass( $factory ) {
    24                 self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
    25                 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
    26                 self::$user_ids[] = self::$no_role_id = $factory->user->create( array( 'role' => '' ) );
     24                self::$editor_id  = $factory->user->create( array( 'role' => 'editor' ) );
     25                self::$user_ids[] = self::$editor_id;
     26                self::$admin_id   = $factory->user->create( array( 'role' => 'administrator' ) );
     27                self::$user_ids[] = self::$admin_id;
     28                self::$no_role_id = $factory->user->create( array( 'role' => '' ) );
     29                self::$user_ids[] = self::$no_role_id;
    2730        }
    2831
  • trunk/tests/phpunit/tests/ajax/Autosave.php

    r42343 r45588  
    3030
    3131        public static function wpSetUpBeforeClass( $factory ) {
    32                 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
    33                 self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
     32                self::$admin_id   = $factory->user->create( array( 'role' => 'administrator' ) );
     33                self::$user_ids[] = self::$admin_id;
     34                self::$editor_id  = $factory->user->create( array( 'role' => 'editor' ) );
     35                self::$user_ids[] = self::$editor_id;
    3436
    3537                self::$post_id = $factory->post->create( array( 'post_status' => 'draft' ) );
  • trunk/tests/phpunit/tests/ajax/CustomizeManager.php

    r42863 r45588  
    120120                // Unauthorized.
    121121                wp_set_current_user( self::$subscriber_user_id );
    122                 $nonce          = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
    123                 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce;
    124                 $exception      = null;
     122                $nonce             = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
     123                $_POST['nonce']    = $nonce;
     124                $_GET['nonce']     = $nonce;
     125                $_REQUEST['nonce'] = $nonce;
     126                $exception         = null;
    125127                try {
    126128                        ob_start();
     
    134136                // Not called setup_theme.
    135137                wp_set_current_user( self::$admin_user_id );
    136                 $nonce          = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
    137                 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce;
     138                $nonce             = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
     139                $_POST['nonce']    = $nonce;
     140                $_GET['nonce']     = $nonce;
     141                $_REQUEST['nonce'] = $nonce;
    138142                $this->make_ajax_call( 'customize_save' );
    139143                $this->assertFalse( $this->_last_response_parsed['success'] );
     
    141145
    142146                // Bad nonce.
    143                 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = 'bad';
     147                $_POST['nonce']    = 'bad';
     148                $_GET['nonce']     = 'bad';
     149                $_REQUEST['nonce'] = 'bad';
    144150                $wp_customize->setup_theme();
    145151                $this->make_ajax_call( 'customize_save' );
     
    149155                // User cannot create.
    150156                $nonce                            = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
    151                 $_POST['nonce']                   = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce;
     157                $_POST['nonce']                   = $nonce;
     158                $_GET['nonce']                    = $nonce;
     159                $_REQUEST['nonce']                = $nonce;
    152160                $post_type_obj                    = get_post_type_object( 'customize_changeset' );
    153161                $post_type_obj->cap->create_posts = 'create_customize_changesets';
     
    251259                );
    252260                $wp_customize->register_controls();
    253                 $nonce          = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
    254                 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce;
     261                $nonce             = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() );
     262                $_POST['nonce']    = $nonce;
     263                $_GET['nonce']     = $nonce;
     264                $_REQUEST['nonce'] = $nonce;
    255265                $wp_customize->setup_theme();
    256266                return $wp_customize;
     
    483493                $this->assertEquals( 'invalid_nonce', $this->_last_response_parsed['data']['code'] );
    484494
    485                 $nonce          = wp_create_nonce( 'trash_customize_changeset' );
    486                 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce;
     495                $nonce             = wp_create_nonce( 'trash_customize_changeset' );
     496                $_POST['nonce']    = $nonce;
     497                $_GET['nonce']     = $nonce;
     498                $_REQUEST['nonce'] = $nonce;
    487499                $this->make_ajax_call( 'customize_trash' );
    488500                $this->assertFalse( $this->_last_response_parsed['success'] );
     
    568580                $this->assertEquals( 'invalid_nonce', $this->_last_response_parsed['data'] );
    569581
    570                 $nonce          = wp_create_nonce( 'customize_dismiss_autosave_or_lock' );
    571                 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce;
    572 
    573                 $_POST['dismiss_lock'] = $_GET['dismiss_lock'] = $_REQUEST['dismiss_lock'] = true;
     582                $nonce             = wp_create_nonce( 'customize_dismiss_autosave_or_lock' );
     583                $_POST['nonce']    = $nonce;
     584                $_GET['nonce']     = $nonce;
     585                $_REQUEST['nonce'] = $nonce;
     586
     587                $_POST['dismiss_lock']    = true;
     588                $_GET['dismiss_lock']     = true;
     589                $_REQUEST['dismiss_lock'] = true;
    574590                $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' );
    575591                $this->assertFalse( $this->_last_response_parsed['success'] );
    576592                $this->assertEquals( 'no_changeset_to_dismiss_lock', $this->_last_response_parsed['data'] );
    577593
    578                 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true;
     594                $_POST['dismiss_autosave']    = true;
     595                $_GET['dismiss_autosave']     = true;
     596                $_REQUEST['dismiss_autosave'] = true;
    579597                $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' );
    580598                $this->assertFalse( $this->_last_response_parsed['success'] );
     
    640658                );
    641659
    642                 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = false;
     660                $_POST['dismiss_autosave']    = false;
     661                $_GET['dismiss_autosave']     = false;
     662                $_REQUEST['dismiss_autosave'] = false;
    643663                $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' );
    644664                $this->assertTrue( $this->_last_response_parsed['success'] );
    645665                $this->assertEquals( 'changeset_lock_dismissed', $this->_last_response_parsed['data'] );
    646666
    647                 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true;
     667                $_POST['dismiss_autosave']    = true;
     668                $_GET['dismiss_autosave']     = true;
     669                $_REQUEST['dismiss_autosave'] = true;
    648670                $this->assertNotWPError( $r );
    649671                $this->assertFalse( wp_get_post_autosave( $wp_customize->changeset_post_id() ) );
  • trunk/tests/phpunit/tests/comment/getCommentAuthorUrlLink.php

    r42343 r45588  
    3232
    3333        public function test_global_comment() {
    34                 $GLOBALS['comment'] = $comment = reset( self::$comments );
     34                $comment            = reset( self::$comments );
     35                $GLOBALS['comment'] = $comment;
    3536
    3637                $url_link = get_comment_author_url_link();
  • trunk/tests/phpunit/tests/comment/getPageOfComment.php

    r45424 r45588  
    258258
    259259                $now        = time();
    260                 $comments_0 = $comments_1 = array();
     260                $comments_0 = array();
     261                $comments_1 = array();
    261262                for ( $i = 0; $i < 5; $i++ ) {
    262263                        $comments_0[] = self::factory()->comment->create(
     
    287288                $post = self::factory()->post->create();
    288289
    289                 $now             = time();
    290                 $comment_parents = $comment_children = array();
     290                $now              = time();
     291                $comment_parents  = array();
     292                $comment_children = array();
    291293                for ( $i = 0; $i < 5; $i++ ) {
    292294                        $parent                = self::factory()->comment->create(
  • trunk/tests/phpunit/tests/customize/manager.php

    r44582 r45588  
    937937                $uuid       = wp_generate_uuid4();
    938938
    939                 $wp_customize = $manager = new WP_Customize_Manager(
     939                $manager      = new WP_Customize_Manager(
    940940                        array(
    941941                                'changeset_uuid' => $uuid,
     
    10401040
    10411041                // Attempt a non-transactional/incremental update.
    1042                 $wp_customize = $manager = new WP_Customize_Manager(
     1042                $manager      = new WP_Customize_Manager(
    10431043                        array(
    10441044                                'changeset_uuid' => $uuid,
     
    11011101                }
    11021102
    1103                 $wp_customize = $manager = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
     1103                $manager      = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
     1104                $wp_customize = $manager;
    11041105                do_action( 'customize_register', $wp_customize );
    11051106                $manager->add_setting(
     
    11431144                add_post_type_support( 'customize_changeset', 'revisions' );
    11441145                $uuid         = wp_generate_uuid4();
    1145                 $wp_customize = $manager = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
     1146                $manager      = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
     1147                $wp_customize = $manager;
    11461148                do_action( 'customize_register', $manager );
    11471149
  • trunk/tests/phpunit/tests/customize/section.php

    r43571 r45588  
    1111
    1212        public static function wpSetUpBeforeClass( $factory ) {
    13                 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
     13                self::$admin_id   = $factory->user->create( array( 'role' => 'administrator' ) );
     14                self::$user_ids[] = self::$admin_id;
    1415        }
    1516
  • trunk/tests/phpunit/tests/db/charset.php

    r42343 r45588  
    455455
    456456                // The data above is easy to edit. Now, prepare it for the data provider.
    457                 $data_provider = $multiple = $multiple_expected = array();
     457                $data_provider     = array();
     458                $multiple          = array();
     459                $multiple_expected = array();
    458460                foreach ( $fields as $test_case => $field ) {
    459461                        $expected          = $field;
     
    583585                unset( $vars['charset'] );
    584586                foreach ( $vars as $var_name => $var ) {
    585                         $data = $expected = $var;
     587                        $data     = $var;
     588                        $expected = $var;
    586589                        foreach ( $data as &$datum ) {
    587590                                // 'charset' and 'ascii' are part of the expected return only.
  • trunk/tests/phpunit/tests/formatting/Autop.php

    r45585 r45588  
    416416                );
    417417
    418                 $content = $expected = array();
     418                $content  = array();
     419                $expected = array();
    419420
    420421                foreach ( $inlines as $inline ) {
     
    544545         */
    545546        function test_that_wpautop_doses_not_add_extra_closing_p_in_figure() {
    546                 $content1 = $expected1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
     547                $content1  = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
     548                $expected1 = $content1;
    547549
    548550                $content2 = '<figure>
  • trunk/tests/phpunit/tests/formatting/SanitizeTextField.php

    r44731 r45588  
    134134                        $expected_multiline = $expected['multiline'];
    135135                } else {
    136                         $expected_oneline = $expected_multiline = $expected;
     136                        $expected_oneline   = $expected;
     137                        $expected_multiline = $expected;
    137138                }
    138139                $this->assertEquals( $expected_oneline, sanitize_text_field( $string ) );
  • trunk/tests/phpunit/tests/formatting/date.php

    r42343 r45588  
    1414        function test_get_date_from_gmt_outside_of_dst() {
    1515                update_option( 'timezone_string', 'Europe/London' );
    16                 $gmt = $local = '2012-01-01 12:34:56';
     16                $local = '2012-01-01 12:34:56';
     17                $gmt   = $local;
    1718                $this->assertEquals( $local, get_date_from_gmt( $gmt ) );
    1819        }
     
    3536        function test_get_gmt_from_date_outside_of_dst() {
    3637                update_option( 'timezone_string', 'Europe/London' );
    37                 $local = $gmt = '2012-01-01 12:34:56';
     38                $local = '2012-01-01 12:34:56';
     39                $gmt   = $local;
    3840                $this->assertEquals( $gmt, get_gmt_from_date( $local ) );
    3941        }
     
    5355         */
    5456        function test_get_date_and_time_from_gmt_no_timezone() {
    55                 $gmt = $local = '2012-01-01 12:34:56';
     57                $local = '2012-01-01 12:34:56';
     58                $gmt   = $local;
    5659                $this->assertEquals( $gmt, get_date_from_gmt( $local ) );
    5760        }
  • trunk/tests/phpunit/tests/functions.php

    r45378 r45588  
    843843                }
    844844
    845                 $old_charsets = $charsets = mb_detect_order();
     845                $charsets     = mb_detect_order();
     846                $old_charsets = $charsets;
    846847                if ( ! in_array( 'EUC-JP', $charsets ) ) {
    847848                        $charsets[] = 'EUC-JP';
     
    867868                }
    868869
    869                 $old_charsets = $charsets = mb_detect_order();
     870                $charsets     = mb_detect_order();
     871                $old_charsets = $charsets;
    870872                if ( ! in_array( 'EUC-JP', $charsets ) ) {
    871873                        $charsets[] = 'EUC-JP';
  • trunk/tests/phpunit/tests/general/archives.php

    r42343 r45588  
    3131                );
    3232                $this->assertInternalType( 'string', $result );
    33                 $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) );
     33                $time1 = wp_cache_get( 'last_changed', 'posts' );
     34                $this->assertNotEmpty( $time1 );
    3435                $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
    3536
  • trunk/tests/phpunit/tests/import/base.php

    r42343 r45588  
    2828                $this->assertTrue( is_file( $file ), 'Import file is not a file.' );
    2929
    30                 $authors = $mapping = $new = array();
     30                $authors = array();
     31                $mapping = array();
     32                $new     = array();
    3133                $i       = 0;
    3234
  • trunk/tests/phpunit/tests/kses.php

    r45363 r45588  
    5555                                $expected_attr = "$name='" . trim( $value, ';' ) . "'";
    5656                        } else {
    57                                 $attr = $expected_attr = $name;
     57                                $attr          = $name;
     58                                $expected_attr = $name;
    5859                        }
    5960                        $string        = "<a $attr>I link this</a>";
  • trunk/tests/phpunit/tests/menu/nav-menu.php

    r44167 r45588  
    5555        function test_filter_registered_locations() {
    5656                $this->register_nav_menu_locations( array( 'primary', 'secondary' ) );
    57                 $old_next_theme_nav_menu_locations = $prev_theme_nav_menu_locations = array(
     57                $prev_theme_nav_menu_locations    = array(
    5858                        'primary'   => 1,
    5959                        'secondary' => 2,
    6060                        'social'    => 3,
    6161                );
     62                $old_next_theme_nav_menu_locations = $prev_theme_nav_menu_locations;
    6263                $new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $prev_theme_nav_menu_locations );
    6364
  • trunk/tests/phpunit/tests/option/wpLoadAllOptions.php

    r42343 r45588  
    105105
    106106        function return_pre_cache_filter( $alloptions ) {
    107                 return $this->alloptions = $alloptions;
     107                $this->alloptions = $alloptions;
     108                return $this->alloptions;
    108109        }
    109110}
  • trunk/tests/phpunit/tests/post.php

    r44454 r45588  
    4949                global $current_user, $user_ID;
    5050
    51                 $current_user = $user_ID = null;
     51                $current_user = null;
     52                $user_ID      = null;
    5253        }
    5354
     
    125126
    126127                // insert a post and make sure the ID is ok
    127                 $id = $this->post_ids[] = wp_insert_post( $post );
     128                $id               = wp_insert_post( $post );
     129                $this->post_ids[] = $id;
    128130                #dmp(_get_cron_array());
    129131                $this->assertTrue( is_numeric( $id ) );
     
    159161
    160162                // insert a post and make sure the ID is ok
    161                 $id = $this->post_ids[] = wp_insert_post( $post );
     163                $id               = wp_insert_post( $post );
     164                $this->post_ids[] = $id;
    162165
    163166                // fetch the post and make sure has the correct date and status
     
    201204
    202205                // insert a post and make sure the ID is ok
    203                 $id = $this->post_ids[] = wp_insert_post( $post );
     206                $id               = wp_insert_post( $post );
     207                $this->post_ids[] = $id;
    204208
    205209                // fetch the post and make sure has the correct date and status
     
    241245
    242246                // insert a post and make sure the ID is ok
    243                 $id = $this->post_ids[] = wp_insert_post( $post );
     247                $id               = wp_insert_post( $post );
     248                $this->post_ids[] = $id;
    244249                #dmp(_get_cron_array());
    245250                $this->assertTrue( is_numeric( $id ) );
     
    273278
    274279                // insert a post and make sure the ID is ok
    275                 $id = $this->post_ids[] = wp_insert_post( $post );
     280                $id               = wp_insert_post( $post );
     281                $this->post_ids[] = $id;
    276282
    277283                // fetch the post and make sure has the correct date and status
     
    314320
    315321                        // insert a post and make sure the ID is ok
    316                         $id = $this->post_ids[] = wp_insert_post( $post );
     322                        $id               = wp_insert_post( $post );
     323                        $this->post_ids[] = $id;
    317324
    318325                        // fetch the post and make sure has the correct date and status
     
    354361
    355362                // insert a post and make sure the ID is ok
    356                 $id = $this->post_ids[] = wp_insert_post( $post );
     363                $id               = wp_insert_post( $post );
     364                $this->post_ids[] = $id;
    357365                #dmp(_get_cron_array());
    358366                $this->assertTrue( is_numeric( $id ) );
     
    408416
    409417                // insert a post and make sure the ID is ok
    410                 $id = $this->post_ids[] = wp_insert_post( $post );
     418                $id               = wp_insert_post( $post );
     419                $this->post_ids[] = $id;
    411420
    412421                // fetch the post and make sure has the correct date and status
     
    512521
    513522                // insert a post and make sure the ID is ok
    514                 $id = $this->post_ids[] = wp_insert_post( $post );
     523                $id               = wp_insert_post( $post );
     524                $this->post_ids[] = $id;
    515525
    516526                // check that there's a publish_future_post job scheduled at the right time
     
    541551
    542552                // insert a post and make sure the ID is ok
    543                 $id = $this->post_ids[] = wp_insert_post( $post );
     553                $id               = wp_insert_post( $post );
     554                $this->post_ids[] = $id;
    544555
    545556                $plink = get_permalink( $id );
  • trunk/tests/phpunit/tests/post/getPages.php

    r44587 r45588  
    2222                $pages = get_pages();
    2323                $this->assertEquals( 3, count( $pages ) );
    24                 $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) );
    25                 $num_queries                  = $wpdb->num_queries;
     24                $time1 = wp_cache_get( 'last_changed', 'posts' );
     25                $this->assertNotEmpty( $time1 );
     26                $num_queries = $wpdb->num_queries;
    2627                foreach ( $pages as $page ) {
    2728                        $this->assertInstanceOf( 'WP_Post', $page );
  • trunk/tests/phpunit/tests/post/wpUniquePostSlug.php

    r42343 r45588  
    3232                                );
    3333
    34                                 $id = $this->post_ids[] = self::factory()->post->create( $post );
     34                                $id               = self::factory()->post->create( $post );
     35                                $this->post_ids[] = $id;
    3536                        }
    3637
  • trunk/tests/phpunit/tests/query/conditionals.php

    r44968 r45588  
    162162        function test_page_trackback() {
    163163                $page_ids   = array();
    164                 $page_ids[] = $page_id = self::factory()->post->create(
     164                $page_id    = self::factory()->post->create(
    165165                        array(
    166166                                'post_type'  => 'page',
     
    168168                        )
    169169                );
    170                 $page_ids[] = $page_id = self::factory()->post->create(
     170                $page_ids[] = $page_id;
     171                $page_id    = self::factory()->post->create(
    171172                        array(
    172173                                'post_type'   => 'page',
     
    175176                        )
    176177                );
    177                 $page_ids[] = $page_id = self::factory()->post->create(
     178                $page_ids[] = $page_id;
     179                $page_ids[] = self::factory()->post->create(
    178180                        array(
    179181                                'post_type'   => 'page',
     
    198200        function test_page_feed() {
    199201                $page_ids   = array();
    200                 $page_ids[] = $page_id = self::factory()->post->create(
     202                $page_id    = self::factory()->post->create(
    201203                        array(
    202204                                'post_type'  => 'page',
     
    204206                        )
    205207                );
    206                 $page_ids[] = $page_id = self::factory()->post->create(
     208                $page_ids[] = $page_id;
     209                $page_id    = self::factory()->post->create(
    207210                        array(
    208211                                'post_type'   => 'page',
     
    211214                        )
    212215                );
    213                 $page_ids[] = $page_id = self::factory()->post->create(
     216                $page_ids[] = $page_id;
     217                $page_ids[] = self::factory()->post->create(
    214218                        array(
    215219                                'post_type'   => 'page',
     
    234238        function test_page_feed_with_no_comments() {
    235239                $page_ids   = array();
    236                 $page_ids[] = $page_id = self::factory()->post->create(
     240                $page_id    = self::factory()->post->create(
    237241                        array(
    238242                                'post_type'  => 'page',
     
    240244                        )
    241245                );
    242                 $page_ids[] = $page_id = self::factory()->post->create(
     246                $page_ids[] = $page_id;
     247                $page_id    = self::factory()->post->create(
    243248                        array(
    244249                                'post_type'   => 'page',
     
    247252                        )
    248253                );
    249                 $page_ids[] = $page_id = self::factory()->post->create(
     254                $page_ids[] = $page_id;
     255                $page_ids[] = self::factory()->post->create(
    250256                        array(
    251257                                'post_type'   => 'page',
     
    270276        function test_page_feed_atom() {
    271277                $page_ids   = array();
    272                 $page_ids[] = $page_id = self::factory()->post->create(
     278                $page_id    = self::factory()->post->create(
    273279                        array(
    274280                                'post_type'  => 'page',
     
    276282                        )
    277283                );
    278                 $page_ids[] = $page_id = self::factory()->post->create(
     284                $page_ids[] = $page_id;
     285                $page_id    = self::factory()->post->create(
    279286                        array(
    280287                                'post_type'   => 'page',
     
    283290                        )
    284291                );
    285                 $page_ids[] = $page_id = self::factory()->post->create(
     292                $page_ids[] = $page_id;
     293                $page_ids[] = self::factory()->post->create(
    286294                        array(
    287295                                'post_type'   => 'page',
  • trunk/tests/phpunit/tests/query/results.php

    r43571 r45588  
    2323
    2424        public static function wpSetUpBeforeClass( $factory ) {
    25                 self::$cat_ids[] = $cat_a = $factory->term->create(
     25                $cat_a          = $factory->term->create(
    2626                        array(
    2727                                'taxonomy' => 'category',
     
    2929                        )
    3030                );
    31                 self::$cat_ids[] = $cat_b = $factory->term->create(
     31                self::$cat_ids[] = $cat_a;
     32                $cat_b           = $factory->term->create(
    3233                        array(
    3334                                'taxonomy' => 'category',
     
    3536                        )
    3637                );
    37                 self::$cat_ids[] = $cat_c = $factory->term->create(
     38                self::$cat_ids[] = $cat_b;
     39                $cat_c           = $factory->term->create(
    3840                        array(
    3941                                'taxonomy' => 'category',
     
    4143                        )
    4244                );
    43 
    44                 self::$tag_ids[] = $tag_a = $factory->term->create(
     45                self::$cat_ids[] = $cat_c;
     46
     47                $tag_a           = $factory->term->create(
    4548                        array(
    4649                                'taxonomy' => 'post_tag',
     
    4851                        )
    4952                );
    50                 self::$tag_ids[] = $tag_b = $factory->term->create(
     53                self::$tag_ids[] = $tag_a;
     54                $tag_b           = $factory->term->create(
    5155                        array(
    5256                                'taxonomy' => 'post_tag',
     
    5458                        )
    5559                );
    56                 self::$tag_ids[] = $tag_c = $factory->term->create(
     60                self::$tag_ids[] = $tag_b;
     61                $tag_c           = $factory->term->create(
    5762                        array(
    5863                                'taxonomy' => 'post_tag',
     
    6065                        )
    6166                );
    62                 self::$tag_ids[] = $tag_nun = $factory->term->create(
     67                self::$tag_ids[] = $tag_c;
     68                $tag_nun         = $factory->term->create(
    6369                        array(
    6470                                'taxonomy' => 'post_tag',
     
    6672                        )
    6773                );
     74                self::$tag_ids[] = $tag_nun;
    6875
    6976                self::$post_ids[] = $factory->post->create(
     
    233240                );
    234241
    235                 self::$post_ids[] = self::$parent_one = $factory->post->create(
     242                self::$parent_one  = $factory->post->create(
    236243                        array(
    237244                                'post_title' => 'parent-one',
     
    239246                        )
    240247                );
    241                 self::$post_ids[] = self::$parent_two = $factory->post->create(
     248                self::$post_ids[]   = self::$parent_one;
     249                self::$parent_two   = $factory->post->create(
    242250                        array(
    243251                                'post_title' => 'parent-two',
     
    245253                        )
    246254                );
    247                 self::$post_ids[] = self::$parent_three = $factory->post->create(
     255                self::$post_ids[]   = self::$parent_two;
     256                self::$parent_three = $factory->post->create(
    248257                        array(
    249258                                'post_title' => 'parent-three',
     
    251260                        )
    252261                );
    253                 self::$post_ids[] = self::$child_one = $factory->post->create(
     262                self::$post_ids[]   = self::$parent_three;
     263                self::$child_one    = $factory->post->create(
    254264                        array(
    255265                                'post_title'  => 'child-one',
     
    258268                        )
    259269                );
    260                 self::$post_ids[] = self::$child_two = $factory->post->create(
     270                self::$post_ids[]   = self::$child_one;
     271                self::$child_two    = $factory->post->create(
    261272                        array(
    262273                                'post_title'  => 'child-two',
     
    265276                        )
    266277                );
    267                 self::$post_ids[] = self::$child_three = $factory->post->create(
     278                self::$post_ids[]   = self::$child_two;
     279                self::$child_three  = $factory->post->create(
    268280                        array(
    269281                                'post_title'  => 'child-three',
     
    272284                        )
    273285                );
    274                 self::$post_ids[] = self::$child_four = $factory->post->create(
     286                self::$post_ids[]   = self::$child_three;
     287                self::$child_four   = $factory->post->create(
    275288                        array(
    276289                                'post_title'  => 'child-four',
     
    279292                        )
    280293                );
     294                self::$post_ids[]   = self::$child_four;
    281295        }
    282296
  • trunk/tests/phpunit/tests/query/setupPostdata.php

    r45285 r45588  
    404404        function test_setup_postdata_loop() {
    405405                $post_id                   = self::factory()->post->create( array( 'post_content' => 'global post' ) );
    406                 $GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id );
     406                $GLOBALS['post']           = get_post( $post_id );
     407                $GLOBALS['wp_query']->post = $GLOBALS['post'];
    407408
    408409                $ids = self::factory()->post->create_many( 5 );
  • trunk/tests/phpunit/tests/query/taxQuery.php

    r43571 r45588  
    12991299                $posts = self::factory()->post->create_many( 5 );
    13001300
    1301                 $cats = $tags = array();
     1301                $cats = array();
     1302                $tags = array();
    13021303
    13031304                // need term_taxonomy_ids in addition to term_ids, so no factory
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r45424 r45588  
    13791379                $this->assertEquals( $attachments_url, $links['https://api.w.org/attachment'][0]['href'] );
    13801380
    1381                 $term_links = $links['https://api.w.org/term'];
    1382                 $tag_link   = $cat_link = $format_link = null;
     1381                $term_links  = $links['https://api.w.org/term'];
     1382                $tag_link    = null;
     1383                $cat_link    = null;
     1384                $format_link = null;
    13831385                foreach ( $term_links as $link ) {
    13841386                        if ( 'post_tag' === $link['attributes']['taxonomy'] ) {
  • trunk/tests/phpunit/tests/user.php

    r44645 r45588  
    1919
    2020        public static function wpSetUpBeforeClass( $factory ) {
    21                 self::$user_ids[] = self::$contrib_id = $factory->user->create(
     21                self::$contrib_id = $factory->user->create(
    2222                        array(
    2323                                'user_login'    => 'user1',
     
    3434                        )
    3535                );
    36 
    37                 self::$user_ids[] = self::$author_id = $factory->user->create(
     36                self::$user_ids[] = self::$contrib_id;
     37
     38                self::$author_id  = $factory->user->create(
    3839                        array(
    3940                                'user_login' => 'author_login',
     
    4243                        )
    4344                );
    44 
    45                 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
    46                 self::$user_ids[] = self::$editor_id = $factory->user->create(
     45                self::$user_ids[] = self::$author_id;
     46
     47                self::$admin_id   = $factory->user->create( array( 'role' => 'administrator' ) );
     48                self::$user_ids[] = self::$admin_id;
     49                self::$editor_id  = $factory->user->create(
    4750                        array(
    4851                                'role'       => 'editor',
     
    5053                        )
    5154                );
    52                 self::$user_ids[] = self::$sub_id = $factory->user->create( array( 'role' => 'subscriber' ) );
     55                self::$user_ids[] = self::$editor_id;
     56                self::$sub_id     = $factory->user->create( array( 'role' => 'subscriber' ) );
     57                self::$user_ids[] = self::$sub_id;
    5358
    5459                self::$_author = get_user_by( 'ID', self::$author_id );
     
    13751380         */
    13761381        function test_edit_user_blank_pw() {
    1377                 $_POST                 = $_GET = $_REQUEST = array();
     1382                $_POST                 = array();
     1383                $_GET                  = array();
     1384                $_REQUEST              = array();
    13781385                $_POST['role']         = 'subscriber';
    13791386                $_POST['email']        = 'user1@example.com';
     
    13911398
    13921399                // Check new user with password set.
    1393                 $_POST['pass1'] = $_POST['pass2'] = 'password';
     1400                $_POST['pass1'] = 'password';
     1401                $_POST['pass2'] = 'password';
    13941402
    13951403                $user_id = edit_user();
     
    14021410                // Check updating user with empty password.
    14031411                $_POST['nickname'] = 'nickname_updated';
    1404                 $_POST['pass1']    = $_POST['pass2'] = '';
     1412                $_POST['pass1']    = '';
     1413                $_POST['pass2']    = '';
    14051414
    14061415                $user_id = edit_user( $user_id );
     
    15511560         */
    15521561        function test_edit_user_role_update() {
    1553                 $_POST = $_GET = $_REQUEST = array();
     1562                $_POST    = array();
     1563                $_GET     = array();
     1564                $_REQUEST = array();
    15541565
    15551566                $administrator = self::factory()->user->create(
  • trunk/tests/phpunit/tests/user/slashes.php

    r42343 r45588  
    2828         */
    2929        function test_add_user() {
    30                 $_POST                 = $_GET = $_REQUEST = array();
     30                $_POST                 = array();
     31                $_GET                  = array();
     32                $_REQUEST              = array();
    3133                $_POST['user_login']   = 'slash_example_user_1';
    3234                $_POST['pass1']        = 'password';
     
    5052                $this->assertEquals( $this->slash_3, $user->description );
    5153
    52                 $_POST                 = $_GET = $_REQUEST = array();
     54                $_POST                 = array();
     55                $_GET                  = array();
     56                $_REQUEST              = array();
    5357                $_POST['user_login']   = 'slash_example_user_2';
    5458                $_POST['pass1']        = 'password';
     
    7983                $id = self::factory()->user->create();
    8084
    81                 $_POST                 = $_GET = $_REQUEST = array();
     85                $_POST                 = array();
     86                $_GET                  = array();
     87                $_REQUEST              = array();
    8288                $_POST['role']         = 'subscriber';
    8389                $_POST['email']        = 'user1@example.com';
     
    98104                $this->assertEquals( $this->slash_3, $user->description );
    99105
    100                 $_POST                 = $_GET = $_REQUEST = array();
     106                $_POST                 = array();
     107                $_GET                  = array();
     108                $_REQUEST              = array();
    101109                $_POST['role']         = 'subscriber';
    102110                $_POST['email']        = 'user2@example.com';
  • trunk/tests/phpunit/tests/user/wpSetCurrentUser.php

    r42343 r45588  
    1010
    1111        public static function wpSetUpBeforeClass( $factory ) {
    12                 self::$user_ids[] = self::$user_id = $factory->user->create();
    13                 self::$user_ids[] = self::$user_id2 = $factory->user->create( array( 'user_login' => 'foo' ) );
     12                self::$user_id    = $factory->user->create();
     13                self::$user_ids[] = self::$user_id;
     14                self::$user_id2   = $factory->user->create( array( 'user_login' => 'foo' ) );
     15                self::$user_ids[] = self::$user_id2;
    1416        }
    1517
Note: See TracChangeset for help on using the changeset viewer.