WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (14 months ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

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

    r48911 r48937  
    8686            $out = get_post( $id );
    8787
    88             $this->assertEquals( $post['post_content'], $out->post_content );
    89             $this->assertEquals( $post['post_title'], $out->post_title );
    90             $this->assertEquals( $post['post_status'], $out->post_status );
     88            $this->assertSame( $post['post_content'], $out->post_content );
     89            $this->assertSame( $post['post_title'], $out->post_title );
     90            $this->assertSame( $post['post_status'], $out->post_status );
    9191            $this->assertEquals( $post['post_author'], $out->post_author );
    9292
     
    9494            $pcache = wp_cache_get( $id, 'posts' );
    9595            $this->assertInstanceOf( 'stdClass', $pcache );
    96             $this->assertEquals( $id, $pcache->ID );
     96            $this->assertSame( $id, $pcache->ID );
    9797
    9898            update_object_term_cache( $id, $post_type );
    9999            $tcache = wp_cache_get( $id, 'post_tag_relationships' );
    100100            $this->assertInternalType( 'array', $tcache );
    101             $this->assertEquals( 2, count( $tcache ) );
     101            $this->assertSame( 2, count( $tcache ) );
    102102
    103103            $tcache = wp_cache_get( $id, 'ctax_relationships' );
    104104            if ( 'cpt' === $post_type ) {
    105105                $this->assertInternalType( 'array', $tcache );
    106                 $this->assertEquals( 2, count( $tcache ) );
     106                $this->assertSame( 2, count( $tcache ) );
    107107            } else {
    108108                $this->assertFalse( $tcache );
     
    142142        $out = get_post( $id );
    143143
    144         $this->assertEquals( $post['post_content'], $out->post_content );
    145         $this->assertEquals( $post['post_title'], $out->post_title );
    146         $this->assertEquals( 'future', $out->post_status );
     144        $this->assertSame( $post['post_content'], $out->post_content );
     145        $this->assertSame( $post['post_title'], $out->post_title );
     146        $this->assertSame( 'future', $out->post_status );
    147147        $this->assertEquals( $post['post_author'], $out->post_author );
    148         $this->assertEquals( $post['post_date'], $out->post_date );
     148        $this->assertSame( $post['post_date'], $out->post_date );
    149149
    150150        // There should be a publish_future_post hook scheduled on the future date.
    151         $this->assertEquals( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     151        $this->assertSame( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    152152    }
    153153
     
    174174        // Fetch the post and make sure has the correct date and status.
    175175        $out = get_post( $id );
    176         $this->assertEquals( 'future', $out->post_status );
    177         $this->assertEquals( $post['post_date'], $out->post_date );
     176        $this->assertSame( 'future', $out->post_status );
     177        $this->assertSame( $post['post_date'], $out->post_date );
    178178
    179179        // Check that there's a publish_future_post job scheduled at the right time.
    180         $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     180        $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    181181
    182182        // Now save it again with a date further in the future.
     
    189189        // Fetch the post again and make sure it has the new post_date.
    190190        $out = get_post( $id );
    191         $this->assertEquals( 'future', $out->post_status );
    192         $this->assertEquals( $post['post_date'], $out->post_date );
     191        $this->assertSame( 'future', $out->post_status );
     192        $this->assertSame( $post['post_date'], $out->post_date );
    193193
    194194        // And the correct date on the cron job.
    195         $this->assertEquals( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     195        $this->assertSame( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    196196    }
    197197
     
    219219        // Fetch the post and make sure has the correct date and status.
    220220        $out = get_post( $id );
    221         $this->assertEquals( 'future', $out->post_status );
    222         $this->assertEquals( $post['post_date'], $out->post_date );
     221        $this->assertSame( 'future', $out->post_status );
     222        $this->assertSame( $post['post_date'], $out->post_date );
    223223
    224224        // Check that there's a publish_future_post job scheduled at the right time.
    225         $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     225        $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    226226
    227227        // Now save it again with a date further in the future.
     
    234234        // Fetch the post again and make sure it has the new post_date.
    235235        $out = get_post( $id );
    236         $this->assertEquals( 'future', $out->post_status );
    237         $this->assertEquals( $post['post_date'], $out->post_date );
     236        $this->assertSame( 'future', $out->post_status );
     237        $this->assertSame( $post['post_date'], $out->post_date );
    238238
    239239        // And the correct date on the cron job.
    240         $this->assertEquals( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     240        $this->assertSame( $future_date_2, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    241241    }
    242242
     
    265265        $out = get_post( $id );
    266266
    267         $this->assertEquals( $post['post_content'], $out->post_content );
    268         $this->assertEquals( $post['post_title'], $out->post_title );
    269         $this->assertEquals( 'draft', $out->post_status );
     267        $this->assertSame( $post['post_content'], $out->post_content );
     268        $this->assertSame( $post['post_title'], $out->post_title );
     269        $this->assertSame( 'draft', $out->post_status );
    270270        $this->assertEquals( $post['post_author'], $out->post_author );
    271         $this->assertEquals( $post['post_date'], $out->post_date );
     271        $this->assertSame( $post['post_date'], $out->post_date );
    272272
    273273        // There should be a publish_future_post hook scheduled on the future date.
    274         $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     274        $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    275275
    276276    }
     
    296296        // Fetch the post and make sure has the correct date and status.
    297297        $out = get_post( $id );
    298         $this->assertEquals( 'future', $out->post_status );
    299         $this->assertEquals( $post['post_date'], $out->post_date );
     298        $this->assertSame( 'future', $out->post_status );
     299        $this->assertSame( $post['post_date'], $out->post_date );
    300300
    301301        // Check that there's a publish_future_post job scheduled at the right time.
    302         $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     302        $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    303303
    304304        // Now save it again with status set to draft.
     
    310310        // Fetch the post again and make sure it has the new post_date.
    311311        $out = get_post( $id );
    312         $this->assertEquals( 'draft', $out->post_status );
    313         $this->assertEquals( $post['post_date'], $out->post_date );
     312        $this->assertSame( 'draft', $out->post_status );
     313        $this->assertSame( $post['post_date'], $out->post_date );
    314314
    315315        // And the correct date on the cron job.
    316         $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     316        $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    317317    }
    318318
     
    340340            // Fetch the post and make sure has the correct date and status.
    341341            $out = get_post( $id );
    342             $this->assertEquals( 'future', $out->post_status );
    343             $this->assertEquals( $post['post_date'], $out->post_date );
     342            $this->assertSame( 'future', $out->post_status );
     343            $this->assertSame( $post['post_date'], $out->post_date );
    344344
    345345            // Check that there's a publish_future_post job scheduled at the right time.
    346             $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     346            $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    347347
    348348            // Now save it again with status changed.
     
    354354            // Fetch the post again and make sure it has the new post_date.
    355355            $out = get_post( $id );
    356             $this->assertEquals( $status, $out->post_status );
    357             $this->assertEquals( $post['post_date'], $out->post_date );
     356            $this->assertSame( $status, $out->post_status );
     357            $this->assertSame( $post['post_date'], $out->post_date );
    358358
    359359            // And the correct date on the cron job.
    360             $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     360            $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    361361        }
    362362    }
     
    386386        $out = get_post( $id );
    387387
    388         $this->assertEquals( $post['post_content'], $out->post_content );
    389         $this->assertEquals( $post['post_title'], $out->post_title );
    390         $this->assertEquals( 'private', $out->post_status );
     388        $this->assertSame( $post['post_content'], $out->post_content );
     389        $this->assertSame( $post['post_title'], $out->post_title );
     390        $this->assertSame( 'private', $out->post_status );
    391391        $this->assertEquals( $post['post_author'], $out->post_author );
    392         $this->assertEquals( $post['post_date'], $out->post_date );
     392        $this->assertSame( $post['post_date'], $out->post_date );
    393393
    394394        // There should be a publish_future_post hook scheduled on the future date.
    395         $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     395        $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    396396    }
    397397
     
    413413        $insert_post = wp_insert_post( $post, true );
    414414        $this->assertWPError( $insert_post );
    415         $this->assertEquals( 'invalid_date', $insert_post->get_error_code() );
     415        $this->assertSame( 'invalid_date', $insert_post->get_error_code() );
    416416
    417417        $insert_post = wp_insert_post( $post );
    418         $this->assertEquals( 0, $insert_post );
     418        $this->assertSame( 0, $insert_post );
    419419    }
    420420
     
    439439        // Fetch the post and make sure has the correct date and status.
    440440        $out = get_post( $id );
    441         $this->assertEquals( 'future', $out->post_status );
    442         $this->assertEquals( $post['post_date'], $out->post_date );
     441        $this->assertSame( 'future', $out->post_status );
     442        $this->assertSame( $post['post_date'], $out->post_date );
    443443
    444444        // Check that there's a publish_future_post job scheduled at the right time.
    445         $this->assertEquals( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     445        $this->assertSame( $future_date_1, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    446446
    447447        // Now save it again with status set to draft.
     
    453453        // Fetch the post again and make sure it has the new post_date.
    454454        $out = get_post( $id );
    455         $this->assertEquals( 'private', $out->post_status );
    456         $this->assertEquals( $post['post_date'], $out->post_date );
     455        $this->assertSame( 'private', $out->post_status );
     456        $this->assertSame( $post['post_date'], $out->post_date );
    457457
    458458        // And the correct date on the cron job.
    459         $this->assertEquals( false, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     459        $this->assertFalse( $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    460460    }
    461461
     
    479479        $this->set_permalink_structure();
    480480
    481         $this->assertEquals( "$p-2", $post->post_name );
     481        $this->assertSame( "$p-2", $post->post_name );
    482482    }
    483483
     
    519519        );
    520520
    521         $this->assertEquals( 'world', get_post_meta( $post_id, 'hello', true ) );
    522         $this->assertEquals( 'bar', get_post_meta( $post_id, 'foo', true ) );
     521        $this->assertSame( 'world', get_post_meta( $post_id, 'hello', true ) );
     522        $this->assertSame( 'bar', get_post_meta( $post_id, 'foo', true ) );
    523523    }
    524524
     
    544544
    545545        // Check that there's a publish_future_post job scheduled at the right time.
    546         $this->assertEquals( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
     546        $this->assertSame( $future_date, $this->_next_schedule_for_post( 'publish_future_post', $id ) );
    547547
    548548        // Now delete the post and make sure the cron entry is removed.
     
    577577
    578578        // Permalink should include the post ID at the end.
    579         $this->assertEquals( get_option( 'siteurl' ) . '/2007/10/31/' . $id . '/', $plink );
     579        $this->assertSame( get_option( 'siteurl' ) . '/2007/10/31/' . $id . '/', $plink );
    580580    }
    581581
     
    584584
    585585        $post = get_post( $draft_id );
    586         $this->assertEquals( 'draft', $post->post_status );
     586        $this->assertSame( 'draft', $post->post_status );
    587587
    588588        wp_publish_post( $draft_id );
    589589        $post = get_post( $draft_id );
    590590
    591         $this->assertEquals( 'publish', $post->post_status );
     591        $this->assertSame( 'publish', $post->post_status );
    592592    }
    593593
     
    605605
    606606        $post = get_post( $post_id );
    607         $this->assertEquals( 'future', $post->post_status );
    608         $this->assertEquals( $future_date, $post->post_date );
     607        $this->assertSame( 'future', $post->post_status );
     608        $this->assertSame( $future_date, $post->post_date );
    609609
    610610        wp_publish_post( $post_id );
    611611        $post = get_post( $post_id );
    612612
    613         $this->assertEquals( 'publish', $post->post_status );
    614         $this->assertEquals( $future_date, $post->post_date );
     613        $this->assertSame( 'publish', $post->post_status );
     614        $this->assertSame( $future_date, $post->post_date );
    615615    }
    616616
     
    627627
    628628        $post = get_post( $post_id );
    629         $this->assertEquals( 'publish', $post->post_status );
    630         $this->assertEquals( $future_date, $post->post_date );
     629        $this->assertSame( 'publish', $post->post_status );
     630        $this->assertSame( $future_date, $post->post_date );
    631631    }
    632632
     
    639639        $post_id = wp_insert_post( array( 'post_title' => '<script>Test</script>' ) );
    640640        $post    = get_post( $post_id );
    641         $this->assertEquals( '<script>Test</script>', $post->post_title );
    642         $this->assertEquals( 'draft', $post->post_status );
     641        $this->assertSame( '<script>Test</script>', $post->post_title );
     642        $this->assertSame( 'draft', $post->post_status );
    643643
    644644        kses_init_filters();
     
    651651        );
    652652        $post = get_post( $post->ID );
    653         $this->assertEquals( 'Test', $post->post_title );
     653        $this->assertSame( 'Test', $post->post_title );
    654654
    655655        kses_remove_filters();
     
    664664        $post_id = wp_insert_post( array( 'post_title' => '<script>Test</script>' ) );
    665665        $post    = get_post( $post_id );
    666         $this->assertEquals( '<script>Test</script>', $post->post_title );
    667         $this->assertEquals( 'draft', $post->post_status );
     666        $this->assertSame( '<script>Test</script>', $post->post_title );
     667        $this->assertSame( 'draft', $post->post_status );
    668668
    669669        kses_init_filters();
     
    671671        wp_publish_post( $post->ID );
    672672        $post = get_post( $post->ID );
    673         $this->assertEquals( '<script>Test</script>', $post->post_title );
     673        $this->assertSame( '<script>Test</script>', $post->post_title );
    674674
    675675        kses_remove_filters();
     
    683683        $parent_id = self::factory()->post->create();
    684684        $post      = self::factory()->post->create_and_get( array( 'post_parent' => $parent_id ) );
    685         $this->assertEquals( array( $parent_id ), get_post_ancestors( 0 ) );
     685        $this->assertSame( array( $parent_id ), get_post_ancestors( 0 ) );
    686686    }
    687687
     
    695695        $post['ID'] = 123456789;
    696696
    697         $this->assertEquals( 0, wp_insert_post( $post ) );
    698         $this->assertEquals( 0, wp_update_post( $post ) );
     697        $this->assertSame( 0, wp_insert_post( $post ) );
     698        $this->assertSame( 0, wp_update_post( $post ) );
    699699
    700700        $this->assertInstanceOf( 'WP_Error', wp_insert_post( $post, true ) );
     
    708708        $post    = get_post( $post_id );
    709709        setup_postdata( $post );
    710         $this->assertEquals( 0, $multipage );
     710        $this->assertSame( 0, $multipage );
    711711        $this->assertCount( 1, $pages );
    712         $this->assertEquals( 1, $numpages );
    713         $this->assertEquals( array( 'Page 0' ), $pages );
     712        $this->assertSame( 1, $numpages );
     713        $this->assertSame( array( 'Page 0' ), $pages );
    714714    }
    715715
     
    719719        $post    = get_post( $post_id );
    720720        setup_postdata( $post );
    721         $this->assertEquals( 1, $multipage );
     721        $this->assertSame( 1, $multipage );
    722722        $this->assertCount( 4, $pages );
    723         $this->assertEquals( 4, $numpages );
    724         $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
     723        $this->assertSame( 4, $numpages );
     724        $this->assertSame( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
    725725    }
    726726
     
    730730        $post    = get_post( $post_id );
    731731        setup_postdata( $post );
    732         $this->assertEquals( 0, $multipage );
     732        $this->assertSame( 0, $multipage );
    733733        $this->assertCount( 1, $pages );
    734         $this->assertEquals( 1, $numpages );
    735         $this->assertEquals( array( 'Page 0' ), $pages );
     734        $this->assertSame( 1, $numpages );
     735        $this->assertSame( array( 'Page 0' ), $pages );
    736736    }
    737737
     
    741741        $post    = get_post( $post_id );
    742742        setup_postdata( $post );
    743         $this->assertEquals( 1, $multipage );
     743        $this->assertSame( 1, $multipage );
    744744        $this->assertCount( 4, $pages );
    745         $this->assertEquals( 4, $numpages );
    746         $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
     745        $this->assertSame( 4, $numpages );
     746        $this->assertSame( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
    747747    }
    748748
     
    755755        $post    = get_post( $post_id );
    756756        setup_postdata( $post );
    757         $this->assertEquals( 1, $multipage );
     757        $this->assertSame( 1, $multipage );
    758758        $this->assertCount( 4, $pages );
    759         $this->assertEquals( 4, $numpages );
    760         $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
     759        $this->assertSame( 4, $numpages );
     760        $this->assertSame( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
    761761    }
    762762
     
    769769        $post    = get_post( $post_id );
    770770        setup_postdata( $post );
    771         $this->assertEquals( 0, $multipage );
     771        $this->assertSame( 0, $multipage );
    772772        $this->assertCount( 1, $pages );
    773         $this->assertEquals( 1, $numpages );
    774         $this->assertEquals( array( 'Page 0' ), $pages );
     773        $this->assertSame( 1, $numpages );
     774        $this->assertSame( array( 'Page 0' ), $pages );
    775775    }
    776776
     
    798798        $post = get_post( $insert_post_id );
    799799        $this->assertEquals( $post->post_author, self::$editor_id );
    800         $this->assertEquals( $post->post_title, $title );
     800        $this->assertSame( $post->post_title, $title );
    801801    }
    802802
     
    853853        wp_insert_post( $_post );
    854854        $post = get_post( $post_ids[ $key ] );
    855         $this->assertEquals( 'draft', $post->post_status );
     855        $this->assertSame( 'draft', $post->post_status );
    856856        $this->assertNotEquals( 'publish', $post->post_status );
    857857
     
    871871
    872872        $post = get_post( $post_ids[ $key ] );
    873         $this->assertEquals( 'trash', $post->post_status );
     873        $this->assertSame( 'trash', $post->post_status );
    874874        $this->assertNotEquals( 'publish', $post->post_status );
    875875
     
    893893        $counts = wp_count_posts();
    894894        $this->assertTrue( isset( $counts->test ) );
    895         $this->assertEquals( 0, $counts->test );
     895        $this->assertSame( 0, $counts->test );
    896896    }
    897897
     
    961961
    962962        foreach ( $expected as $field => $value ) {
    963             $this->assertEquals( $value, $post->$field );
     963            $this->assertSame( $value, $post->$field );
    964964        }
    965965    }
     
    979979        $post    = get_post( $post_id );
    980980
    981         $this->assertEquals( 'open', $post->comment_status );
    982         $this->assertEquals( 'open', $post->ping_status );
     981        $this->assertSame( 'open', $post->comment_status );
     982        $this->assertSame( 'open', $post->ping_status );
    983983    }
    984984
     
    998998        $post    = get_post( $post_id );
    999999
    1000         $this->assertEquals( 'closed', $post->comment_status );
    1001         $this->assertEquals( 'closed', $post->ping_status );
     1000        $this->assertSame( 'closed', $post->comment_status );
     1001        $this->assertSame( 'closed', $post->ping_status );
    10021002    }
    10031003
     
    10191019        $post    = get_post( $post_id );
    10201020
    1021         $this->assertEquals( 'open', $post->comment_status );
    1022         $this->assertEquals( 'open', $post->ping_status );
     1021        $this->assertSame( 'open', $post->comment_status );
     1022        $this->assertSame( 'open', $post->ping_status );
    10231023        _unregister_post_type( $post_type );
    10241024    }
     
    10411041        $post    = get_post( $post_id );
    10421042
    1043         $this->assertEquals( 'closed', $post->comment_status );
    1044         $this->assertEquals( 'closed', $post->ping_status );
     1043        $this->assertSame( 'closed', $post->comment_status );
     1044        $this->assertSame( 'closed', $post->ping_status );
    10451045        _unregister_post_type( $post_type );
    10461046    }
     
    10801080        $saved_post = get_post( $post->ID );
    10811081        $this->assertTrue( is_sticky( $saved_post->ID ) );
    1082         $this->assertEquals( 'Updated', $saved_post->post_title );
    1083         $this->assertEquals( 'Updated', $saved_post->post_content );
     1082        $this->assertSame( 'Updated', $saved_post->post_title );
     1083        $this->assertSame( 'Updated', $saved_post->post_content );
    10841084    }
    10851085
     
    11211121        $saved_post = get_post( $post->ID );
    11221122        $this->assertTrue( is_sticky( $saved_post->ID ) );
    1123         $this->assertEquals( 'Updated', $saved_post->post_title );
    1124         $this->assertEquals( 'Updated', $saved_post->post_content );
     1123        $this->assertSame( 'Updated', $saved_post->post_title );
     1124        $this->assertSame( 'Updated', $saved_post->post_content );
    11251125    }
    11261126
     
    11481148        remove_action( 'post_unstuck', array( $a2, 'action' ) );
    11491149
    1150         $this->assertEquals( 1, $a1->get_call_count() );
    1151         $this->assertEquals( 1, $a2->get_call_count() );
     1150        $this->assertSame( 1, $a1->get_call_count() );
     1151        $this->assertSame( 1, $a2->get_call_count() );
    11521152    }
    11531153
     
    11751175        $updated_post = get_post( $post_id );
    11761176        // Ensure changing the post_title didn't modify the post_name.
    1177         $this->assertEquals( 'stuff', $updated_post->post_name );
     1177        $this->assertSame( 'stuff', $updated_post->post_name );
    11781178    }
    11791179
     
    12131213        $out = get_post( $id );
    12141214
    1215         $this->assertEquals( $post['post_content'], $out->post_content );
    1216         $this->assertEquals( $post['post_title'], $out->post_title );
     1215        $this->assertSame( $post['post_content'], $out->post_content );
     1216        $this->assertSame( $post['post_title'], $out->post_title );
    12171217        $this->assertEquals( $post['post_author'], $out->post_author );
    1218         $this->assertEquals( get_date_from_gmt( $post['post_date_gmt'] ), $out->post_date );
    1219         $this->assertEquals( $post['post_date_gmt'], $out->post_date_gmt );
     1218        $this->assertSame( get_date_from_gmt( $post['post_date_gmt'] ), $out->post_date );
     1219        $this->assertSame( $post['post_date_gmt'], $out->post_date_gmt );
    12201220    }
    12211221
     
    12341234            )
    12351235        );
    1236         $this->assertEquals( $parent_page_id, get_post( $page_id )->post_parent );
     1236        $this->assertSame( $parent_page_id, get_post( $page_id )->post_parent );
    12371237        wp_delete_post( $parent_page_id, true );
    1238         $this->assertEquals( $grandparent_page_id, get_post( $page_id )->post_parent );
     1238        $this->assertSame( $grandparent_page_id, get_post( $page_id )->post_parent );
    12391239        wp_delete_post( $grandparent_page_id, true );
    1240         $this->assertEquals( 0, get_post( $page_id )->post_parent );
     1240        $this->assertSame( 0, get_post( $page_id )->post_parent );
    12411241    }
    12421242
     
    12491249    function test_wp_insert_post_for_customize_changeset_should_not_drop_post_name() {
    12501250
    1251         $this->assertEquals( 10, has_filter( 'wp_insert_post_data', '_wp_customize_changeset_filter_insert_post_data' ) );
     1251        $this->assertSame( 10, has_filter( 'wp_insert_post_data', '_wp_customize_changeset_filter_insert_post_data' ) );
    12521252
    12531253        $changeset_data = array(
     
    12671267            )
    12681268        );
    1269         $this->assertEquals( $uuid, get_post( $post_id )->post_name, 'Expected lower-case UUID4 to be inserted.' );
    1270         $this->assertEquals( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
     1269        $this->assertSame( $uuid, get_post( $post_id )->post_name, 'Expected lower-case UUID4 to be inserted.' );
     1270        $this->assertSame( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
    12711271
    12721272        $changeset_data['blogname']['value'] = 'Hola Mundo';
     
    12781278            )
    12791279        );
    1280         $this->assertEquals( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for drafts.' );
    1281         $this->assertEquals( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
     1280        $this->assertSame( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for drafts.' );
     1281        $this->assertSame( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
    12821282
    12831283        $changeset_data['blogname']['value'] = 'Hallo Welt';
     
    12891289            )
    12901290        );
    1291         $this->assertEquals( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for pending.' );
    1292         $this->assertEquals( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
     1291        $this->assertSame( $uuid, get_post( $post_id )->post_name, 'Expected post_name to not have been dropped for pending.' );
     1292        $this->assertSame( $changeset_data, json_decode( get_post( $post_id )->post_content, true ) );
    12931293    }
    12941294
     
    13111311        );
    13121312        $post    = get_post( $post_id );
    1313         $this->assertEquals( 'override-slug-' . $post->post_type, $post->post_name );
     1313        $this->assertSame( 'override-slug-' . $post->post_type, $post->post_name );
    13141314
    13151315        remove_filter( 'pre_wp_unique_post_slug', array( $this, 'filter_pre_wp_unique_post_slug' ), 10, 6 );
     
    13351335
    13361336        $post = get_post( $post_id );
    1337         self::assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt );
     1337        self::assertSame( '0000-00-00 00:00:00', $post->post_date_gmt );
    13381338    }
    13391339
Note: See TracChangeset for help on using the changeset viewer.