WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (2 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/post/objects.php

    r38951 r42343  
    3232        $post = get_post( $id, ARRAY_A );
    3333        $this->assertInternalType( 'array', $post );
    34         $this->assertEquals( 'post', $post[ 'post_type' ] );
     34        $this->assertEquals( 'post', $post['post_type'] );
    3535
    3636        $post = get_post( $id, ARRAY_N );
    3737        $this->assertInternalType( 'array', $post );
    38         $this->assertFalse( isset( $post[ 'post_type' ] ) );
     38        $this->assertFalse( isset( $post['post_type'] ) );
    3939        $this->assertTrue( in_array( 'post', $post ) );
    4040
     
    4242        $post = get_post( $post, ARRAY_A );
    4343        $this->assertInternalType( 'array', $post );
    44         $this->assertEquals( 'post', $post[ 'post_type' ] );
    45         $this->assertEquals( $id, $post[ 'ID' ] );
     44        $this->assertEquals( 'post', $post['post_type'] );
     45        $this->assertEquals( $id, $post['ID'] );
    4646
    4747        // Should default to OBJECT when given invalid output argument
     
    5353        $post_std = $post->to_array();
    5454        $this->assertInternalType( 'array', $post_std );
    55         $post_std = (object) $post_std;
     55        $post_std        = (object) $post_std;
    5656        $GLOBALS['post'] = $post_std;
    57         $post = get_post( null );
     57        $post            = get_post( null );
    5858        $this->assertInstanceOf( 'WP_Post', $post );
    5959        $this->assertEquals( $id, $post->ID );
     
    6868
    6969    function test_get_post_ancestors() {
    70         $parent_id = self::factory()->post->create();
    71         $child_id = self::factory()->post->create();
     70        $parent_id     = self::factory()->post->create();
     71        $child_id      = self::factory()->post->create();
    7272        $grandchild_id = self::factory()->post->create();
    73         $updated = wp_update_post( array( 'ID' => $child_id, 'post_parent' => $parent_id ) );
     73        $updated       = wp_update_post(
     74            array(
     75                'ID'          => $child_id,
     76                'post_parent' => $parent_id,
     77            )
     78        );
    7479        $this->assertEquals( $updated, $child_id );
    75         $updated = wp_update_post( array( 'ID' => $grandchild_id, 'post_parent' => $child_id ) );
     80        $updated = wp_update_post(
     81            array(
     82                'ID'          => $grandchild_id,
     83                'post_parent' => $child_id,
     84            )
     85        );
    7686        $this->assertEquals( $updated, $grandchild_id );
    7787
     
    101111    function test_get_post_category_property() {
    102112        $post_id = self::factory()->post->create();
    103         $post = get_post( $post_id );
     113        $post    = get_post( $post_id );
    104114
    105115        $this->assertInternalType( 'array', $post->post_category );
     
    111121        wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'], $term3['term_id'] ) );
    112122        $this->assertEquals( 3, count( $post->post_category ) );
    113         $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post->post_category );
     123        $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post->post_category );
    114124
    115125        $post = get_post( $post_id, ARRAY_A );
    116126        $this->assertEquals( 3, count( $post['post_category'] ) );
    117         $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post['post_category'] );
     127        $this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post['post_category'] );
    118128    }
    119129
    120130    function test_get_tags_input_property() {
    121131        $post_id = self::factory()->post->create();
    122         $post = get_post( $post_id );
     132        $post    = get_post( $post_id );
    123133
    124134        $this->assertInternalType( 'array', $post->tags_input );
     
    137147    function test_get_page_template_property() {
    138148        $post_id = self::factory()->post->create();
    139         $post = get_post( $post_id );
     149        $post    = get_post( $post_id );
    140150
    141151        $this->assertInternalType( 'string', $post->page_template );
     
    150160
    151161    function test_get_post_filter() {
    152         $post = get_post( self::factory()->post->create( array(
    153             'post_title' => "Mary's home"
    154         ) ) );
     162        $post = get_post(
     163            self::factory()->post->create(
     164                array(
     165                    'post_title' => "Mary's home",
     166                )
     167            )
     168        );
    155169
    156170        $this->assertEquals( 'raw', $post->filter );
Note: See TracChangeset for help on using the changeset viewer.