Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 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/query/conditionals.php

    r39599 r42343  
    2929
    3030    function test_home() {
    31         $this->go_to('/');
     31        $this->go_to( '/' );
    3232        $this->assertQueryTrue( 'is_home', 'is_front_page' );
    3333    }
    3434
    3535    function test_page_on_front() {
    36         $page_on_front = self::factory()->post->create( array(
    37             'post_type' => 'page',
    38         ) );
    39         $page_for_posts = self::factory()->post->create( array(
    40             'post_type' => 'page',
    41         ) );
     36        $page_on_front  = self::factory()->post->create(
     37            array(
     38                'post_type' => 'page',
     39            )
     40        );
     41        $page_for_posts = self::factory()->post->create(
     42            array(
     43                'post_type' => 'page',
     44            )
     45        );
    4246        update_option( 'show_on_front', 'page' );
    4347        update_option( 'page_on_front', $page_on_front );
     
    5761    function test_404() {
    5862        $this->go_to( '/notapage' );
    59         $this->assertQueryTrue('is_404');
     63        $this->assertQueryTrue( 'is_404' );
    6064    }
    6165
     
    6367        $post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) );
    6468        $this->go_to( get_permalink( $post_id ) );
    65         $this->assertQueryTrue('is_single', 'is_singular');
     69        $this->assertQueryTrue( 'is_single', 'is_singular' );
    6670    }
    6771
     
    7074        self::factory()->comment->create_post_comments( $post_id, 2 );
    7175        $this->go_to( get_post_comments_feed_link( $post_id ) );
    72         $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
     76        $this->assertQueryTrue( 'is_feed', 'is_single', 'is_singular', 'is_comment_feed' );
    7377    }
    7478
     
    7781        $post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) );
    7882        $this->go_to( get_post_comments_feed_link( $post_id ) );
    79         $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
     83        $this->assertQueryTrue( 'is_feed', 'is_single', 'is_singular', 'is_comment_feed' );
    8084    }
    8185
     
    8892
    8993    function test_page() {
    90         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
     94        $page_id = self::factory()->post->create(
     95            array(
     96                'post_type'  => 'page',
     97                'post_title' => 'about',
     98            )
     99        );
    91100        $this->go_to( get_permalink( $page_id ) );
    92         $this->assertQueryTrue('is_page','is_singular');
     101        $this->assertQueryTrue( 'is_page', 'is_singular' );
    93102    }
    94103
    95104    function test_parent_page() {
    96         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     105        $page_id = self::factory()->post->create(
     106            array(
     107                'post_type'  => 'page',
     108                'post_title' => 'parent-page',
     109            )
     110        );
    97111        $this->go_to( get_permalink( $page_id ) );
    98112
    99         $this->assertQueryTrue('is_page','is_singular');
     113        $this->assertQueryTrue( 'is_page', 'is_singular' );
    100114    }
    101115
    102116    function test_child_page_1() {
    103         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    104         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     117        $page_id = self::factory()->post->create(
     118            array(
     119                'post_type'  => 'page',
     120                'post_title' => 'parent-page',
     121            )
     122        );
     123        $page_id = self::factory()->post->create(
     124            array(
     125                'post_type'   => 'page',
     126                'post_title'  => 'child-page-1',
     127                'post_parent' => $page_id,
     128            )
     129        );
    105130        $this->go_to( get_permalink( $page_id ) );
    106131
    107         $this->assertQueryTrue('is_page','is_singular');
     132        $this->assertQueryTrue( 'is_page', 'is_singular' );
    108133    }
    109134
    110135    function test_child_page_2() {
    111         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    112         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    113         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     136        $page_id = self::factory()->post->create(
     137            array(
     138                'post_type'  => 'page',
     139                'post_title' => 'parent-page',
     140            )
     141        );
     142        $page_id = self::factory()->post->create(
     143            array(
     144                'post_type'   => 'page',
     145                'post_title'  => 'child-page-1',
     146                'post_parent' => $page_id,
     147            )
     148        );
     149        $page_id = self::factory()->post->create(
     150            array(
     151                'post_type'   => 'page',
     152                'post_title'  => 'child-page-2',
     153                'post_parent' => $page_id,
     154            )
     155        );
    114156        $this->go_to( get_permalink( $page_id ) );
    115157
    116         $this->assertQueryTrue('is_page','is_singular');
     158        $this->assertQueryTrue( 'is_page', 'is_singular' );
    117159    }
    118160
    119161    // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
    120162    function test_page_trackback() {
    121         $page_ids = array();
    122         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    123         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    124         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     163        $page_ids   = array();
     164        $page_ids[] = $page_id = self::factory()->post->create(
     165            array(
     166                'post_type'  => 'page',
     167                'post_title' => 'parent-page',
     168            )
     169        );
     170        $page_ids[] = $page_id = self::factory()->post->create(
     171            array(
     172                'post_type'   => 'page',
     173                'post_title'  => 'child-page-1',
     174                'post_parent' => $page_id,
     175            )
     176        );
     177        $page_ids[] = $page_id = self::factory()->post->create(
     178            array(
     179                'post_type'   => 'page',
     180                'post_title'  => 'child-page-2',
     181                'post_parent' => $page_id,
     182            )
     183        );
    125184        foreach ( $page_ids as $page_id ) {
    126185            $url = get_permalink( $page_id );
    127             $this->go_to("{$url}trackback/");
     186            $this->go_to( "{$url}trackback/" );
    128187
    129188            // make sure the correct wp_query flags are set
    130             $this->assertQueryTrue('is_page','is_singular','is_trackback');
     189            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_trackback' );
    131190
    132191            // make sure the correct page was fetched
     
    138197    //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
    139198    function test_page_feed() {
    140         $page_ids = array();
    141         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    142         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    143         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     199        $page_ids   = array();
     200        $page_ids[] = $page_id = self::factory()->post->create(
     201            array(
     202                'post_type'  => 'page',
     203                'post_title' => 'parent-page',
     204            )
     205        );
     206        $page_ids[] = $page_id = self::factory()->post->create(
     207            array(
     208                'post_type'   => 'page',
     209                'post_title'  => 'child-page-1',
     210                'post_parent' => $page_id,
     211            )
     212        );
     213        $page_ids[] = $page_id = self::factory()->post->create(
     214            array(
     215                'post_type'   => 'page',
     216                'post_title'  => 'child-page-2',
     217                'post_parent' => $page_id,
     218            )
     219        );
    144220        foreach ( $page_ids as $page_id ) {
    145221            self::factory()->comment->create_post_comments( $page_id, 2 );
    146222            $url = get_permalink( $page_id );
    147             $this->go_to("{$url}feed/");
     223            $this->go_to( "{$url}feed/" );
    148224
    149225            // make sure the correct wp_query flags are set
    150             $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
     226            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' );
    151227
    152228            // make sure the correct page was fetched
     
    157233
    158234    function test_page_feed_with_no_comments() {
    159         $page_ids = array();
    160         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    161         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    162         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     235        $page_ids   = array();
     236        $page_ids[] = $page_id = self::factory()->post->create(
     237            array(
     238                'post_type'  => 'page',
     239                'post_title' => 'parent-page',
     240            )
     241        );
     242        $page_ids[] = $page_id = self::factory()->post->create(
     243            array(
     244                'post_type'   => 'page',
     245                'post_title'  => 'child-page-1',
     246                'post_parent' => $page_id,
     247            )
     248        );
     249        $page_ids[] = $page_id = self::factory()->post->create(
     250            array(
     251                'post_type'   => 'page',
     252                'post_title'  => 'child-page-2',
     253                'post_parent' => $page_id,
     254            )
     255        );
    163256        foreach ( $page_ids as $page_id ) {
    164257            $url = get_permalink( $page_id );
    165             $this->go_to("{$url}feed/");
     258            $this->go_to( "{$url}feed/" );
    166259
    167260            // make sure the correct wp_query flags are set
    168             $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
     261            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' );
    169262
    170263            // make sure the correct page was fetched
     
    176269    // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
    177270    function test_page_feed_atom() {
    178         $page_ids = array();
    179         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    180         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    181         $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     271        $page_ids   = array();
     272        $page_ids[] = $page_id = self::factory()->post->create(
     273            array(
     274                'post_type'  => 'page',
     275                'post_title' => 'parent-page',
     276            )
     277        );
     278        $page_ids[] = $page_id = self::factory()->post->create(
     279            array(
     280                'post_type'   => 'page',
     281                'post_title'  => 'child-page-1',
     282                'post_parent' => $page_id,
     283            )
     284        );
     285        $page_ids[] = $page_id = self::factory()->post->create(
     286            array(
     287                'post_type'   => 'page',
     288                'post_title'  => 'child-page-2',
     289                'post_parent' => $page_id,
     290            )
     291        );
    182292        foreach ( $page_ids as $page_id ) {
    183293            self::factory()->comment->create_post_comments( $page_id, 2 );
    184294
    185295            $url = get_permalink( $page_id );
    186             $this->go_to("{$url}feed/atom/");
     296            $this->go_to( "{$url}feed/atom/" );
    187297
    188298            // make sure the correct wp_query flags are set
    189             $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
     299            $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' );
    190300
    191301            // make sure the correct page was fetched
     
    197307    // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
    198308    function test_page_page_2() {
    199         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
    200         $this->go_to("/about/page/2/");
     309        $page_id = self::factory()->post->create(
     310            array(
     311                'post_type'    => 'page',
     312                'post_title'   => 'about',
     313                'post_content' => 'Page 1 <!--nextpage--> Page 2',
     314            )
     315        );
     316        $this->go_to( '/about/page/2/' );
    201317
    202318        // make sure the correct wp_query flags are set
    203         $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
     319        $this->assertQueryTrue( 'is_page', 'is_singular', 'is_paged' );
    204320
    205321        // make sure the correct page was fetched
     
    210326    // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
    211327    function test_page_page_2_no_slash() {
    212         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
    213         $this->go_to("/about/page2/");
     328        $page_id = self::factory()->post->create(
     329            array(
     330                'post_type'    => 'page',
     331                'post_title'   => 'about',
     332                'post_content' => 'Page 1 <!--nextpage--> Page 2',
     333            )
     334        );
     335        $this->go_to( '/about/page2/' );
    214336
    215337        // make sure the correct wp_query flags are set
    216         $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
     338        $this->assertQueryTrue( 'is_page', 'is_singular', 'is_paged' );
    217339
    218340        // make sure the correct page was fetched
     
    223345    // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
    224346    function test_pagination_of_posts_page() {
    225         $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     347        $page_id = self::factory()->post->create(
     348            array(
     349                'post_type'    => 'page',
     350                'post_title'   => 'about',
     351                'post_content' => 'Page 1 <!--nextpage--> Page 2',
     352            )
     353        );
    226354        update_option( 'show_on_front', 'page' );
    227355        update_option( 'page_for_posts', $page_id );
    228356
    229         $this->go_to('/about/2/');
     357        $this->go_to( '/about/2/' );
    230358
    231359        $this->assertQueryTrue( 'is_home', 'is_posts_page' );
     
    249377    function test_main_feed_2() {
    250378        self::factory()->post->create(); // @test_404
    251         $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     379        $feeds = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
    252380
    253381        // long version
    254         foreach ($feeds as $feed) {
    255             $this->go_to("/feed/{$feed}/");
    256             $this->assertQueryTrue('is_feed');
     382        foreach ( $feeds as $feed ) {
     383            $this->go_to( "/feed/{$feed}/" );
     384            $this->assertQueryTrue( 'is_feed' );
    257385        }
    258386
    259387        // short version
    260         foreach ($feeds as $feed) {
    261             $this->go_to("/{$feed}/");
    262             $this->assertQueryTrue('is_feed');
     388        foreach ( $feeds as $feed ) {
     389            $this->go_to( "/{$feed}/" );
     390            $this->assertQueryTrue( 'is_feed' );
    263391        }
    264392
     
    267395    function test_main_feed() {
    268396        self::factory()->post->create(); // @test_404
    269         $types = array('rss2', 'rss', 'atom');
    270         foreach ($types as $type) {
    271             $this->go_to(get_feed_link($type));
    272             $this->assertQueryTrue('is_feed');
     397        $types = array( 'rss2', 'rss', 'atom' );
     398        foreach ( $types as $type ) {
     399            $this->go_to( get_feed_link( $type ) );
     400            $this->assertQueryTrue( 'is_feed' );
    273401        }
    274402    }
     
    279407        self::factory()->post->create_many( 5 );
    280408        for ( $i = 2; $i <= 3; $i++ ) {
    281             $this->go_to("/page/{$i}/");
     409            $this->go_to( "/page/{$i}/" );
    282410            $this->assertQueryTrue( 'is_home', 'is_front_page', 'is_paged' );
    283411        }
     
    292420        // check the url as generated by get_post_comments_feed_link()
    293421        $this->go_to( get_post_comments_feed_link( $post_id ) );
    294         $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
     422        $this->assertQueryTrue( 'is_feed', 'is_single', 'is_singular', 'is_comment_feed' );
    295423
    296424        // check the long form
    297         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    298         foreach ($types as $type) {
    299                 $this->go_to("/comments/feed/{$type}");
    300                 $this->assertQueryTrue('is_feed', 'is_comment_feed');
     425        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     426        foreach ( $types as $type ) {
     427                $this->go_to( "/comments/feed/{$type}" );
     428                $this->assertQueryTrue( 'is_feed', 'is_comment_feed' );
    301429        }
    302430
    303431        // check the short form
    304         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    305         foreach ($types as $type) {
    306                 $this->go_to("/comments/{$type}");
    307                 $this->assertQueryTrue('is_feed', 'is_comment_feed');
     432        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     433        foreach ( $types as $type ) {
     434                $this->go_to( "/comments/{$type}" );
     435                $this->assertQueryTrue( 'is_feed', 'is_comment_feed' );
    308436        }
    309437
     
    314442    function test_search_feed() {
    315443        // check the long form
    316         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    317         foreach ($types as $type) {
    318                 $this->go_to("/search/test/feed/{$type}");
    319                 $this->assertQueryTrue('is_feed', 'is_search');
     444        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     445        foreach ( $types as $type ) {
     446                $this->go_to( "/search/test/feed/{$type}" );
     447                $this->assertQueryTrue( 'is_feed', 'is_search' );
    320448        }
    321449
    322450        // check the short form
    323         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    324         foreach ($types as $type) {
    325                 $this->go_to("/search/test/{$type}");
    326                 $this->assertQueryTrue('is_feed', 'is_search');
     451        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     452        foreach ( $types as $type ) {
     453                $this->go_to( "/search/test/{$type}" );
     454                $this->assertQueryTrue( 'is_feed', 'is_search' );
    327455        }
    328456    }
     
    332460        update_option( 'posts_per_page', 2 );
    333461        self::factory()->post->create_many( 3, array( 'post_title' => 'test' ) );
    334         $this->go_to('/search/test/page/2/');
    335         $this->assertQueryTrue('is_search', 'is_paged');
     462        $this->go_to( '/search/test/page/2/' );
     463        $this->assertQueryTrue( 'is_search', 'is_paged' );
    336464    }
    337465
    338466    // 'search/(.+)/?$' => 'index.php?s=$matches[1]',
    339467    function test_search() {
    340         $this->go_to('/search/test/');
    341         $this->assertQueryTrue('is_search');
     468        $this->go_to( '/search/test/' );
     469        $this->assertQueryTrue( 'is_search' );
    342470    }
    343471
     
    346474     */
    347475    function test_search_encoded_chars() {
    348         $this->go_to('/search/F%C3%BCnf%2Bbar/');
     476        $this->go_to( '/search/F%C3%BCnf%2Bbar/' );
    349477        $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' );
    350478    }
     
    353481    // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
    354482    function test_category_feed() {
    355         self::factory()->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
     483        self::factory()->term->create(
     484            array(
     485                'name'     => 'cat-a',
     486                'taxonomy' => 'category',
     487            )
     488        );
    356489
    357490        // check the long form
    358         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    359         foreach ($types as $type) {
    360             $this->go_to("/category/cat-a/feed/{$type}");
    361             $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
     491        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     492        foreach ( $types as $type ) {
     493            $this->go_to( "/category/cat-a/feed/{$type}" );
     494            $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_category' );
    362495        }
    363496
    364497        // check the short form
    365         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    366         foreach ($types as $type) {
    367             $this->go_to("/category/cat-a/{$type}");
    368             $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
     498        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     499        foreach ( $types as $type ) {
     500            $this->go_to( "/category/cat-a/{$type}" );
     501            $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_category' );
    369502        }
    370503    }
     
    374507        update_option( 'posts_per_page', 2 );
    375508        self::factory()->post->create_many( 3 );
    376         $this->go_to('/category/uncategorized/page/2/');
    377         $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
     509        $this->go_to( '/category/uncategorized/page/2/' );
     510        $this->assertQueryTrue( 'is_archive', 'is_category', 'is_paged' );
    378511    }
    379512
    380513    // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
    381514    function test_category() {
    382         self::factory()->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
    383         $this->go_to('/category/cat-a/');
    384         $this->assertQueryTrue('is_archive', 'is_category');
     515        self::factory()->term->create(
     516            array(
     517                'name'     => 'cat-a',
     518                'taxonomy' => 'category',
     519            )
     520        );
     521        $this->go_to( '/category/cat-a/' );
     522        $this->assertQueryTrue( 'is_archive', 'is_category' );
    385523    }
    386524
     
    388526    // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
    389527    function test_tag_feed() {
    390         self::factory()->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
     528        self::factory()->term->create(
     529            array(
     530                'name'     => 'tag-a',
     531                'taxonomy' => 'post_tag',
     532            )
     533        );
    391534        // check the long form
    392         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    393         foreach ($types as $type) {
    394                 $this->go_to("/tag/tag-a/feed/{$type}");
    395                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
     535        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     536        foreach ( $types as $type ) {
     537                $this->go_to( "/tag/tag-a/feed/{$type}" );
     538                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_tag' );
    396539        }
    397540
    398541        // check the short form
    399         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    400         foreach ($types as $type) {
    401                 $this->go_to("/tag/tag-a/{$type}");
    402                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
     542        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     543        foreach ( $types as $type ) {
     544                $this->go_to( "/tag/tag-a/{$type}" );
     545                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_tag' );
    403546        }
    404547    }
     
    408551        update_option( 'posts_per_page', 2 );
    409552        $post_ids = self::factory()->post->create_many( 3 );
    410         foreach ( $post_ids as $post_id )
     553        foreach ( $post_ids as $post_id ) {
    411554            self::factory()->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
    412         $this->go_to('/tag/tag-a/page/2/');
    413         $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
     555        }
     556        $this->go_to( '/tag/tag-a/page/2/' );
     557        $this->assertQueryTrue( 'is_archive', 'is_tag', 'is_paged' );
    414558    }
    415559
    416560    // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
    417561    function test_tag() {
    418         $term_id = self::factory()->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );
    419         $this->go_to('/tag/tag-a/');
    420         $this->assertQueryTrue('is_archive', 'is_tag');
     562        $term_id = self::factory()->term->create(
     563            array(
     564                'name'     => 'Tag Named A',
     565                'slug'     => 'tag-a',
     566                'taxonomy' => 'post_tag',
     567            )
     568        );
     569        $this->go_to( '/tag/tag-a/' );
     570        $this->assertQueryTrue( 'is_archive', 'is_tag' );
    421571
    422572        $tag = get_term( $term_id, 'post_tag' );
     
    437587        self::factory()->user->create( array( 'user_login' => 'user-a' ) );
    438588        // check the long form
    439         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    440         foreach ($types as $type) {
    441                 $this->go_to("/author/user-a/feed/{$type}");
    442                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
     589        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     590        foreach ( $types as $type ) {
     591                $this->go_to( "/author/user-a/feed/{$type}" );
     592                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_author' );
    443593        }
    444594
    445595        // check the short form
    446         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    447         foreach ($types as $type) {
    448                 $this->go_to("/author/user-a/{$type}");
    449                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
     596        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     597        foreach ( $types as $type ) {
     598                $this->go_to( "/author/user-a/{$type}" );
     599                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_author' );
    450600        }
    451601    }
     
    456606        $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
    457607        self::factory()->post->create_many( 3, array( 'post_author' => $user_id ) );
    458         $this->go_to('/author/user-a/page/2/');
    459         $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
     608        $this->go_to( '/author/user-a/page/2/' );
     609        $this->assertQueryTrue( 'is_archive', 'is_author', 'is_paged' );
    460610    }
    461611
     
    464614        $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
    465615        self::factory()->post->create( array( 'post_author' => $user_id ) );
    466         $this->go_to('/author/user-a/');
    467         $this->assertQueryTrue('is_archive', 'is_author');
     616        $this->go_to( '/author/user-a/' );
     617        $this->assertQueryTrue( 'is_archive', 'is_author' );
    468618    }
    469619
    470620    function test_author_with_no_posts() {
    471621        $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
    472         $this->go_to('/author/user-a/');
    473         $this->assertQueryTrue('is_archive', 'is_author');
     622        $this->go_to( '/author/user-a/' );
     623        $this->assertQueryTrue( 'is_archive', 'is_author' );
    474624    }
    475625
     
    479629        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    480630        // check the long form
    481         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    482         foreach ($types as $type) {
    483                 $this->go_to("/2007/09/04/feed/{$type}");
    484                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
     631        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     632        foreach ( $types as $type ) {
     633                $this->go_to( "/2007/09/04/feed/{$type}" );
     634                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_day', 'is_date' );
    485635        }
    486636
    487637        // check the short form
    488         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    489         foreach ($types as $type) {
    490                 $this->go_to("/2007/09/04/{$type}");
    491                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
     638        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     639        foreach ( $types as $type ) {
     640                $this->go_to( "/2007/09/04/{$type}" );
     641                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_day', 'is_date' );
    492642        }
    493643    }
     
    497647        update_option( 'posts_per_page', 2 );
    498648        self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    499         $this->go_to('/2007/09/04/page/2/');
    500         $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
     649        $this->go_to( '/2007/09/04/page/2/' );
     650        $this->assertQueryTrue( 'is_archive', 'is_day', 'is_date', 'is_paged' );
    501651    }
    502652
     
    504654    function test_ymd() {
    505655        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    506         $this->go_to('/2007/09/04/');
    507         $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
     656        $this->go_to( '/2007/09/04/' );
     657        $this->assertQueryTrue( 'is_archive', 'is_day', 'is_date' );
    508658    }
    509659
     
    513663        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    514664        // check the long form
    515         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    516         foreach ($types as $type) {
    517                 $this->go_to("/2007/09/feed/{$type}");
    518                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
     665        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     666        foreach ( $types as $type ) {
     667                $this->go_to( "/2007/09/feed/{$type}" );
     668                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_month', 'is_date' );
    519669        }
    520670
    521671        // check the short form
    522         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    523         foreach ($types as $type) {
    524                 $this->go_to("/2007/09/{$type}");
    525                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
     672        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     673        foreach ( $types as $type ) {
     674                $this->go_to( "/2007/09/{$type}" );
     675                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_month', 'is_date' );
    526676        }
    527677    }
     
    531681        update_option( 'posts_per_page', 2 );
    532682        self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    533         $this->go_to('/2007/09/page/2/');
    534         $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
     683        $this->go_to( '/2007/09/page/2/' );
     684        $this->assertQueryTrue( 'is_archive', 'is_date', 'is_month', 'is_paged' );
    535685    }
    536686
     
    538688    function test_ym() {
    539689        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    540         $this->go_to('/2007/09/');
    541         $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
     690        $this->go_to( '/2007/09/' );
     691        $this->assertQueryTrue( 'is_archive', 'is_date', 'is_month' );
    542692    }
    543693
     
    547697        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    548698        // check the long form
    549         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    550         foreach ($types as $type) {
    551                 $this->go_to("/2007/feed/{$type}");
    552                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
     699        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     700        foreach ( $types as $type ) {
     701                $this->go_to( "/2007/feed/{$type}" );
     702                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_year', 'is_date' );
    553703        }
    554704
    555705        // check the short form
    556         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    557         foreach ($types as $type) {
    558                 $this->go_to("/2007/{$type}");
    559                 $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
     706        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     707        foreach ( $types as $type ) {
     708                $this->go_to( "/2007/{$type}" );
     709                $this->assertQueryTrue( 'is_archive', 'is_feed', 'is_year', 'is_date' );
    560710        }
    561711    }
     
    565715        update_option( 'posts_per_page', 2 );
    566716        self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    567         $this->go_to('/2007/page/2/');
    568         $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
     717        $this->go_to( '/2007/page/2/' );
     718        $this->assertQueryTrue( 'is_archive', 'is_date', 'is_year', 'is_paged' );
    569719    }
    570720
     
    572722    function test_y() {
    573723        self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    574         $this->go_to('/2007/');
    575         $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
     724        $this->go_to( '/2007/' );
     725        $this->assertQueryTrue( 'is_archive', 'is_date', 'is_year' );
    576726    }
    577727
    578728    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
    579729    function test_post_trackback() {
    580         $post_id = self::factory()->post->create();
     730        $post_id   = self::factory()->post->create();
    581731        $permalink = get_permalink( $post_id );
    582         $this->go_to("{$permalink}trackback/");
    583         $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
     732        $this->go_to( "{$permalink}trackback/" );
     733        $this->assertQueryTrue( 'is_single', 'is_singular', 'is_trackback' );
    584734    }
    585735
     
    587737    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
    588738    function test_post_comment_feed() {
    589         $post_id = self::factory()->post->create();
     739        $post_id   = self::factory()->post->create();
    590740        $permalink = get_permalink( $post_id );
    591741
    592         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    593         foreach ($types as $type) {
    594                 $this->go_to("{$permalink}feed/{$type}");
    595                 $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
     742        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     743        foreach ( $types as $type ) {
     744                $this->go_to( "{$permalink}feed/{$type}" );
     745                $this->assertQueryTrue( 'is_single', 'is_singular', 'is_feed', 'is_comment_feed' );
    596746        }
    597747
    598748        // check the short form
    599         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    600         foreach ($types as $type) {
    601                 $this->go_to("{$permalink}{$type}");
    602                 $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
     749        $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
     750        foreach ( $types as $type ) {
     751                $this->go_to( "{$permalink}{$type}" );
     752                $this->assertQueryTrue( 'is_single', 'is_singular', 'is_feed', 'is_comment_feed' );
    603753        }
    604754    }
     
    606756    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
    607757    function test_post_paged_short() {
    608         $post_id = self::factory()->post->create( array(
    609             'post_date' => '2007-09-04 00:00:00',
    610             'post_title' => 'a-post-with-multiple-pages',
    611             'post_content' => 'Page 1 <!--nextpage--> Page 2'
    612         ) );
     758        $post_id = self::factory()->post->create(
     759            array(
     760                'post_date'    => '2007-09-04 00:00:00',
     761                'post_title'   => 'a-post-with-multiple-pages',
     762                'post_content' => 'Page 1 <!--nextpage--> Page 2',
     763            )
     764        );
    613765        $this->go_to( get_permalink( $post_id ) . '2/' );
    614766        // should is_paged be true also?
    615         $this->assertQueryTrue('is_single', 'is_singular');
     767        $this->assertQueryTrue( 'is_single', 'is_singular' );
    616768
    617769    }
     
    619771    // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
    620772    function test_post_attachment() {
    621         $post_id = self::factory()->post->create( array( 'post_type' => 'attachment' ) );
     773        $post_id   = self::factory()->post->create( array( 'post_type' => 'attachment' ) );
    622774        $permalink = get_attachment_link( $post_id );
    623         $this->go_to($permalink);
    624         $this->assertQueryTrue('is_single', 'is_attachment', 'is_singular');
     775        $this->go_to( $permalink );
     776        $this->assertQueryTrue( 'is_single', 'is_attachment', 'is_singular' );
    625777    }
    626778
     
    648800
    649801        $cpt_name = 'ptawtq';
    650         register_post_type( $cpt_name, array(
    651             'taxonomies' => array( 'post_tag', 'category' ),
    652             'rewrite' => true,
    653             'has_archive' => true,
    654             'public' => true
    655         ) );
    656 
    657         $tag_id = self::factory()->tag->create( array( 'slug' => 'tag-slug' ) );
     802        register_post_type(
     803            $cpt_name, array(
     804                'taxonomies'  => array( 'post_tag', 'category' ),
     805                'rewrite'     => true,
     806                'has_archive' => true,
     807                'public'      => true,
     808            )
     809        );
     810
     811        $tag_id  = self::factory()->tag->create( array( 'slug' => 'tag-slug' ) );
    658812        $post_id = self::factory()->post->create( array( 'post_type' => $cpt_name ) );
    659813        wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
     
    674828    function pre_get_posts_with_tax_query( &$query ) {
    675829        $term = get_term_by( 'slug', 'tag-slug', 'post_tag' );
    676         $query->set( 'tax_query', array(
    677             array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $term->term_id )
    678         ) );
     830        $query->set(
     831            'tax_query', array(
     832                array(
     833                    'taxonomy' => 'post_tag',
     834                    'field'    => 'term_id',
     835                    'terms'    => $term->term_id,
     836                ),
     837            )
     838        );
    679839    }
    680840
     
    683843
    684844        $cpt_name = 'thearray';
    685         register_post_type( $cpt_name, array(
    686             'taxonomies' => array( 'post_tag', 'category' ),
    687             'rewrite' => true,
    688             'has_archive' => true,
    689             'public' => true
    690         ) );
     845        register_post_type(
     846            $cpt_name, array(
     847                'taxonomies'  => array( 'post_tag', 'category' ),
     848                'rewrite'     => true,
     849                'has_archive' => true,
     850                'public'      => true,
     851            )
     852        );
    691853        self::factory()->post->create( array( 'post_type' => $cpt_name ) );
    692854
     
    713875
    714876        $post = get_queried_object();
    715         $q = $GLOBALS['wp_query'];
     877        $q    = $GLOBALS['wp_query'];
    716878
    717879        $this->assertTrue( is_single() );
     
    732894        $post_type = 'test_hierarchical';
    733895
    734         register_post_type( $post_type, array(
    735             'hierarchical' => true,
    736             'rewrite'      => true,
    737             'has_archive'  => true,
    738             'public'       => true
    739         ) );
     896        register_post_type(
     897            $post_type, array(
     898                'hierarchical' => true,
     899                'rewrite'      => true,
     900                'has_archive'  => true,
     901                'public'       => true,
     902            )
     903        );
    740904
    741905        // Create parent and child posts
    742         $parent_id = self::factory()->post->create( array(
    743             'post_type' => $post_type,
    744             'post_name' => 'foo'
    745         ) );
    746 
    747         $post_id = self::factory()->post->create( array(
    748             'post_type'   => $post_type,
    749             'post_name'   => 'bar',
    750             'post_parent' => $parent_id
    751         ) );
     906        $parent_id = self::factory()->post->create(
     907            array(
     908                'post_type' => $post_type,
     909                'post_name' => 'foo',
     910            )
     911        );
     912
     913        $post_id = self::factory()->post->create(
     914            array(
     915                'post_type'   => $post_type,
     916                'post_name'   => 'bar',
     917                'post_parent' => $parent_id,
     918            )
     919        );
    752920
    753921        // Tests
     
    755923
    756924        $post = get_queried_object();
    757         $q = $GLOBALS['wp_query'];
     925        $q    = $GLOBALS['wp_query'];
    758926
    759927        $this->assertTrue( is_single() );
     
    779947
    780948        $p2_name = $p1 . '-post';
    781         $p2 = self::factory()->post->create( array(
    782             'slug' => $p2_name,
    783         ) );
     949        $p2      = self::factory()->post->create(
     950            array(
     951                'slug' => $p2_name,
     952            )
     953        );
    784954
    785955        $this->go_to( "/?p=$p1" );
     
    799969        $this->set_permalink_structure( '/%postname%/' );
    800970
    801         $attachment_id = $this->factory->post->create( array(
    802             'post_type'  => 'attachment',
    803         ) );
    804 
    805         $post_id = $this->factory->post->create( array(
    806             'post_title' => get_post( $attachment_id )->post_title
    807         ) );
     971        $attachment_id = $this->factory->post->create(
     972            array(
     973                'post_type' => 'attachment',
     974            )
     975        );
     976
     977        $post_id = $this->factory->post->create(
     978            array(
     979                'post_title' => get_post( $attachment_id )->post_title,
     980            )
     981        );
    808982
    809983        $this->go_to( get_permalink( $post_id ) );
     
    825999        $post_id = self::factory()->post->create();
    8261000
    827         $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    828             'post_mime_type' => 'image/jpeg',
    829         ) );
     1001        $attachment_id = self::factory()->attachment->create_object(
     1002            'image.jpg', $post_id, array(
     1003                'post_mime_type' => 'image/jpeg',
     1004            )
     1005        );
    8301006
    8311007        $this->go_to( get_permalink( $attachment_id ) );
     
    8431019
    8441020        $post = get_queried_object();
    845         $q = $GLOBALS['wp_query'];
     1021        $q    = $GLOBALS['wp_query'];
    8461022
    8471023        $this->assertTrue( is_page() );
     
    8591035     */
    8601036    function test_is_page_with_parent() {
    861         $parent_id = self::factory()->post->create( array(
    862             'post_type' => 'page',
    863             'post_name' => 'foo',
    864         ) );
    865         $post_id = self::factory()->post->create( array(
    866             'post_type'   => 'page',
    867             'post_name'   => 'bar',
    868             'post_parent' => $parent_id,
    869         ) );
     1037        $parent_id = self::factory()->post->create(
     1038            array(
     1039                'post_type' => 'page',
     1040                'post_name' => 'foo',
     1041            )
     1042        );
     1043        $post_id   = self::factory()->post->create(
     1044            array(
     1045                'post_type'   => 'page',
     1046                'post_name'   => 'bar',
     1047                'post_parent' => $parent_id,
     1048            )
     1049        );
    8701050        $this->go_to( "/?page_id=$post_id" );
    8711051
    8721052        $post = get_queried_object();
    873         $q = $GLOBALS['wp_query'];
     1053        $q    = $GLOBALS['wp_query'];
    8741054
    8751055        $this->assertTrue( is_page() );
     
    8931073
    8941074        $post = get_queried_object();
    895         $q = $GLOBALS['wp_query'];
     1075        $q    = $GLOBALS['wp_query'];
    8961076
    8971077        $this->assertTrue( is_attachment() );
     
    9131093
    9141094        $p2_name = $p1 . '-attachment';
    915         $p2 = self::factory()->post->create( array(
    916             'post_type' => 'attachment',
    917             'post_name' => $p2_name,
    918         ) );
     1095        $p2      = self::factory()->post->create(
     1096            array(
     1097                'post_type' => 'attachment',
     1098                'post_name' => $p2_name,
     1099            )
     1100        );
    9191101
    9201102        $this->go_to( "/?attachment_id=$p1" );
     
    9351117
    9361118        $u2_name = $u1 . '_user';
    937         $u2 = self::factory()->user->create( array(
    938             'user_nicename' => $u2_name,
    939         ) );
     1119        $u2      = self::factory()->user->create(
     1120            array(
     1121                'user_nicename' => $u2_name,
     1122            )
     1123        );
    9401124
    9411125        $this->go_to( "/?author=$u1" );
     
    9561140
    9571141        $c2_name = $c1 . '-category';
    958         $c2 = self::factory()->category->create( array(
    959             'slug' => $c2_name,
    960         ) );
     1142        $c2      = self::factory()->category->create(
     1143            array(
     1144                'slug' => $c2_name,
     1145            )
     1146        );
    9611147
    9621148        $this->go_to( "/?cat=$c1" );
     
    9771163
    9781164        $t2_name = $t1 . '-tag';
    979         $t2 = self::factory()->tag->create( array(
    980             'slug' => $t2_name,
    981         ) );
     1165        $t2      = self::factory()->tag->create(
     1166            array(
     1167                'slug' => $t2_name,
     1168            )
     1169        );
    9821170
    9831171        $this->go_to( "/?tag_id=$t1" );
     
    9991187
    10001188        // override post ID to 0 temporarily for testing
    1001         $_id = $GLOBALS['wp_query']->post->ID;
     1189        $_id                           = $GLOBALS['wp_query']->post->ID;
    10021190        $GLOBALS['wp_query']->post->ID = 0;
    10031191
    10041192        $post = get_queried_object();
    1005         $q = $GLOBALS['wp_query'];
     1193        $q    = $GLOBALS['wp_query'];
    10061194
    10071195        $this->assertTrue( $q->is_page() );
     
    10201208
    10211209        $p2_name = $p1 . '-page';
    1022         $p2 = self::factory()->post->create( array(
    1023             'post_type' => 'page',
    1024             'post_name' => $p2_name,
    1025         ) );
     1210        $p2      = self::factory()->post->create(
     1211            array(
     1212                'post_type' => 'page',
     1213                'post_name' => $p2_name,
     1214            )
     1215        );
    10261216
    10271217        $this->go_to( "/?page_id=$p1" );
     
    10371227    function test_is_page_template() {
    10381228        $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    1039         update_post_meta($post_id, '_wp_page_template', 'example.php');
     1229        update_post_meta( $post_id, '_wp_page_template', 'example.php' );
    10401230        $this->go_to( "/?page_id=$post_id" );
    10411231        $this->assertTrue( is_page_template( 'example.php' ) );
     
    10571247    function test_is_page_template_array() {
    10581248        $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    1059         update_post_meta($post_id, '_wp_page_template', 'example.php');
     1249        update_post_meta( $post_id, '_wp_page_template', 'example.php' );
    10601250        $this->go_to( "/?page_id=$post_id" );
    10611251        $this->assertFalse( is_page_template( array( 'test.php' ) ) );
    1062         $this->assertTrue( is_page_template( array('test.php', 'example.php') ) );
     1252        $this->assertTrue( is_page_template( array( 'test.php', 'example.php' ) ) );
    10631253    }
    10641254
     
    11041294     */
    11051295    public function test_is_attachment_should_not_match_numeric_id_to_post_title_beginning_with_id() {
    1106         $p1 = self::factory()->post->create( array(
    1107             'post_type' => 'attachment',
    1108             'post_title' => 'Foo',
    1109             'post_name' => 'foo',
    1110         ) );
    1111         $p2 = self::factory()->post->create( array(
    1112             'post_type' => 'attachment',
    1113             'post_title' => "$p1 Foo",
    1114             'post_name' => 'foo-2',
    1115         ) );
     1296        $p1 = self::factory()->post->create(
     1297            array(
     1298                'post_type'  => 'attachment',
     1299                'post_title' => 'Foo',
     1300                'post_name'  => 'foo',
     1301            )
     1302        );
     1303        $p2 = self::factory()->post->create(
     1304            array(
     1305                'post_type'  => 'attachment',
     1306                'post_title' => "$p1 Foo",
     1307                'post_name'  => 'foo-2',
     1308            )
     1309        );
    11161310
    11171311        $this->go_to( get_permalink( $p2 ) );
     
    11251319     */
    11261320    public function test_is_attachment_should_not_match_numeric_id_to_post_name_beginning_with_id() {
    1127         $p1 = self::factory()->post->create( array(
    1128             'post_type' => 'attachment',
    1129             'post_title' => 'Foo',
    1130             'post_name' => 'foo',
    1131         ) );
    1132         $p2 = self::factory()->post->create( array(
    1133             'post_type' => 'attachment',
    1134             'post_title' => 'Foo',
    1135             'post_name' => "$p1-foo",
    1136         ) );
     1321        $p1 = self::factory()->post->create(
     1322            array(
     1323                'post_type'  => 'attachment',
     1324                'post_title' => 'Foo',
     1325                'post_name'  => 'foo',
     1326            )
     1327        );
     1328        $p2 = self::factory()->post->create(
     1329            array(
     1330                'post_type'  => 'attachment',
     1331                'post_title' => 'Foo',
     1332                'post_name'  => "$p1-foo",
     1333            )
     1334        );
    11371335
    11381336        $this->go_to( get_permalink( $p2 ) );
     
    11461344     */
    11471345    public function test_is_author_should_not_match_numeric_id_to_nickname_beginning_with_id() {
    1148         $u1 = self::factory()->user->create( array(
    1149             'nickname' => 'Foo',
    1150             'user_nicename' => 'foo',
    1151         ) );
    1152         $u2 = self::factory()->user->create( array(
    1153             'nickname' => "$u1 Foo",
    1154             'user_nicename' => 'foo-2',
    1155         ) );
     1346        $u1 = self::factory()->user->create(
     1347            array(
     1348                'nickname'      => 'Foo',
     1349                'user_nicename' => 'foo',
     1350            )
     1351        );
     1352        $u2 = self::factory()->user->create(
     1353            array(
     1354                'nickname'      => "$u1 Foo",
     1355                'user_nicename' => 'foo-2',
     1356            )
     1357        );
    11561358
    11571359        $this->go_to( get_author_posts_url( $u2 ) );
     
    11651367     */
    11661368    public function test_is_author_should_not_match_numeric_id_to_user_nicename_beginning_with_id() {
    1167         $u1 = self::factory()->user->create( array(
    1168             'nickname' => 'Foo',
    1169             'user_nicename' => 'foo',
    1170         ) );
    1171         $u2 = self::factory()->user->create( array(
    1172             'nickname' => 'Foo',
    1173             'user_nicename' => "$u1-foo",
    1174         ) );
     1369        $u1 = self::factory()->user->create(
     1370            array(
     1371                'nickname'      => 'Foo',
     1372                'user_nicename' => 'foo',
     1373            )
     1374        );
     1375        $u2 = self::factory()->user->create(
     1376            array(
     1377                'nickname'      => 'Foo',
     1378                'user_nicename' => "$u1-foo",
     1379            )
     1380        );
    11751381
    11761382        $this->go_to( get_author_posts_url( $u2 ) );
     
    11841390     */
    11851391    public function test_is_category_should_not_match_numeric_id_to_name_beginning_with_id() {
    1186         $t1 = self::factory()->term->create( array(
    1187             'taxonomy' => 'category',
    1188             'slug' => 'foo',
    1189             'name' => 'foo',
    1190         ) );
    1191         $t2 = self::factory()->term->create( array(
    1192             'taxonomy' => 'category',
    1193             'slug' => "$t1-foo",
    1194             'name' => 'foo 2',
    1195         ) );
     1392        $t1 = self::factory()->term->create(
     1393            array(
     1394                'taxonomy' => 'category',
     1395                'slug'     => 'foo',
     1396                'name'     => 'foo',
     1397            )
     1398        );
     1399        $t2 = self::factory()->term->create(
     1400            array(
     1401                'taxonomy' => 'category',
     1402                'slug'     => "$t1-foo",
     1403                'name'     => 'foo 2',
     1404            )
     1405        );
    11961406
    11971407        $this->go_to( get_term_link( $t2 ) );
     
    12051415     */
    12061416    public function test_is_category_should_not_match_numeric_id_to_slug_beginning_with_id() {
    1207         $t1 = self::factory()->term->create( array(
    1208             'taxonomy' => 'category',
    1209             'slug' => 'foo',
    1210             'name' => 'foo',
    1211         ) );
    1212         $t2 = self::factory()->term->create( array(
    1213             'taxonomy' => 'category',
    1214             'slug' => 'foo-2',
    1215             'name' => "$t1 foo",
    1216         ) );
     1417        $t1 = self::factory()->term->create(
     1418            array(
     1419                'taxonomy' => 'category',
     1420                'slug'     => 'foo',
     1421                'name'     => 'foo',
     1422            )
     1423        );
     1424        $t2 = self::factory()->term->create(
     1425            array(
     1426                'taxonomy' => 'category',
     1427                'slug'     => 'foo-2',
     1428                'name'     => "$t1 foo",
     1429            )
     1430        );
    12171431
    12181432        $this->go_to( get_term_link( $t2 ) );
     
    12261440     */
    12271441    public function test_is_tag_should_not_match_numeric_id_to_name_beginning_with_id() {
    1228         $t1 = self::factory()->term->create( array(
    1229             'taxonomy' => 'post_tag',
    1230             'slug' => 'foo',
    1231             'name' => 'foo',
    1232         ) );
    1233         $t2 = self::factory()->term->create( array(
    1234             'taxonomy' => 'post_tag',
    1235             'slug' => "$t1-foo",
    1236             'name' => 'foo 2',
    1237         ) );
     1442        $t1 = self::factory()->term->create(
     1443            array(
     1444                'taxonomy' => 'post_tag',
     1445                'slug'     => 'foo',
     1446                'name'     => 'foo',
     1447            )
     1448        );
     1449        $t2 = self::factory()->term->create(
     1450            array(
     1451                'taxonomy' => 'post_tag',
     1452                'slug'     => "$t1-foo",
     1453                'name'     => 'foo 2',
     1454            )
     1455        );
    12381456
    12391457        $this->go_to( get_term_link( $t2 ) );
     
    12471465     */
    12481466    public function test_is_tag_should_not_match_numeric_id_to_slug_beginning_with_id() {
    1249         $t1 = self::factory()->term->create( array(
    1250             'taxonomy' => 'post_tag',
    1251             'slug' => 'foo',
    1252             'name' => 'foo',
    1253         ) );
    1254         $t2 = self::factory()->term->create( array(
    1255             'taxonomy' => 'post_tag',
    1256             'slug' => 'foo-2',
    1257             'name' => "$t1 foo",
    1258         ) );
     1467        $t1 = self::factory()->term->create(
     1468            array(
     1469                'taxonomy' => 'post_tag',
     1470                'slug'     => 'foo',
     1471                'name'     => 'foo',
     1472            )
     1473        );
     1474        $t2 = self::factory()->term->create(
     1475            array(
     1476                'taxonomy' => 'post_tag',
     1477                'slug'     => 'foo-2',
     1478                'name'     => "$t1 foo",
     1479            )
     1480        );
    12591481
    12601482        $this->go_to( get_term_link( $t2 ) );
     
    12681490     */
    12691491    public function test_is_page_should_not_match_numeric_id_to_post_title_beginning_with_id() {
    1270         $p1 = self::factory()->post->create( array(
    1271             'post_type' => 'page',
    1272             'post_title' => 'Foo',
    1273             'post_name' => 'foo',
    1274         ) );
    1275         $p2 = self::factory()->post->create( array(
    1276             'post_type' => 'page',
    1277             'post_title' => "$p1 Foo",
    1278             'post_name' => 'foo-2',
    1279         ) );
     1492        $p1 = self::factory()->post->create(
     1493            array(
     1494                'post_type'  => 'page',
     1495                'post_title' => 'Foo',
     1496                'post_name'  => 'foo',
     1497            )
     1498        );
     1499        $p2 = self::factory()->post->create(
     1500            array(
     1501                'post_type'  => 'page',
     1502                'post_title' => "$p1 Foo",
     1503                'post_name'  => 'foo-2',
     1504            )
     1505        );
    12801506
    12811507        $this->go_to( get_permalink( $p2 ) );
     
    12891515     */
    12901516    public function test_is_page_should_not_match_numeric_id_to_post_name_beginning_with_id() {
    1291         $p1 = self::factory()->post->create( array(
    1292             'post_type' => 'page',
    1293             'post_title' => 'Foo',
    1294             'post_name' => 'foo',
    1295         ) );
    1296         $p2 = self::factory()->post->create( array(
    1297             'post_type' => 'page',
    1298             'post_title' => 'Foo',
    1299             'post_name' => "$p1-foo",
    1300         ) );
     1517        $p1 = self::factory()->post->create(
     1518            array(
     1519                'post_type'  => 'page',
     1520                'post_title' => 'Foo',
     1521                'post_name'  => 'foo',
     1522            )
     1523        );
     1524        $p2 = self::factory()->post->create(
     1525            array(
     1526                'post_type'  => 'page',
     1527                'post_title' => 'Foo',
     1528                'post_name'  => "$p1-foo",
     1529            )
     1530        );
    13011531
    13021532        $this->go_to( get_permalink( $p2 ) );
     
    13101540     */
    13111541    public function test_is_single_should_not_match_numeric_id_to_post_title_beginning_with_id() {
    1312         $p1 = self::factory()->post->create( array(
    1313             'post_type' => 'post',
    1314             'post_title' => 'Foo',
    1315             'post_name' => 'foo',
    1316         ) );
    1317         $p2 = self::factory()->post->create( array(
    1318             'post_type' => 'post',
    1319             'post_title' => "$p1 Foo",
    1320             'post_name' => 'foo-2',
    1321         ) );
     1542        $p1 = self::factory()->post->create(
     1543            array(
     1544                'post_type'  => 'post',
     1545                'post_title' => 'Foo',
     1546                'post_name'  => 'foo',
     1547            )
     1548        );
     1549        $p2 = self::factory()->post->create(
     1550            array(
     1551                'post_type'  => 'post',
     1552                'post_title' => "$p1 Foo",
     1553                'post_name'  => 'foo-2',
     1554            )
     1555        );
    13221556
    13231557        $this->go_to( get_permalink( $p2 ) );
     
    13311565     */
    13321566    public function test_is_single_should_not_match_numeric_id_to_post_name_beginning_with_id() {
    1333         $p1 = self::factory()->post->create( array(
    1334             'post_type' => 'post',
    1335             'post_title' => 'Foo',
    1336             'post_name' => 'foo',
    1337         ) );
    1338         $p2 = self::factory()->post->create( array(
    1339             'post_type' => 'post',
    1340             'post_title' => 'Foo',
    1341             'post_name' => "$p1-foo",
    1342         ) );
     1567        $p1 = self::factory()->post->create(
     1568            array(
     1569                'post_type'  => 'post',
     1570                'post_title' => 'Foo',
     1571                'post_name'  => 'foo',
     1572            )
     1573        );
     1574        $p2 = self::factory()->post->create(
     1575            array(
     1576                'post_type'  => 'post',
     1577                'post_title' => 'Foo',
     1578                'post_name'  => "$p1-foo",
     1579            )
     1580        );
    13431581
    13441582        $this->go_to( get_permalink( $p2 ) );
Note: See TracChangeset for help on using the changeset viewer.