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/general/document-title.php

    r39172 r42343  
    1515
    1616    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    17         self::$category_id = $factory->category->create( array(
    18             'name' => 'test_category',
    19         ) );
    20 
    21         self::$author_id = $factory->user->create( array(
    22             'role'        => 'author',
    23             'user_login'  => 'test_author',
    24             'description' => 'test_author',
    25         ) );
    26 
    27         self::$post_id = $factory->post->create( array(
    28             'post_author'  => self::$author_id,
    29             'post_status'  => 'publish',
    30             'post_title'   => 'test_title',
    31             'post_type'    => 'post',
    32             'post_date'    => '2015-09-22 18:52:17',
    33             'category'     => self::$category_id,
    34         ) );
     17        self::$category_id = $factory->category->create(
     18            array(
     19                'name' => 'test_category',
     20            )
     21        );
     22
     23        self::$author_id = $factory->user->create(
     24            array(
     25                'role'        => 'author',
     26                'user_login'  => 'test_author',
     27                'description' => 'test_author',
     28            )
     29        );
     30
     31        self::$post_id = $factory->post->create(
     32            array(
     33                'post_author' => self::$author_id,
     34                'post_status' => 'publish',
     35                'post_title'  => 'test_title',
     36                'post_type'   => 'post',
     37                'post_date'   => '2015-09-22 18:52:17',
     38                'category'    => self::$category_id,
     39            )
     40        );
    3541    }
    3642
     
    8490    function test_front_page_title() {
    8591        update_option( 'show_on_front', 'page' );
    86         update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
     92        update_option(
     93            'page_on_front', $this->factory->post->create(
     94                array(
     95                    'post_title' => 'front-page',
     96                    'post_type'  => 'page',
     97                )
     98            )
     99        );
    87100        add_filter( 'document_title_parts', array( $this, '_front_page_title_parts' ) );
    88101
     
    105118
    106119    function test_home_title() {
    107         $blog_page_id = $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) );
     120        $blog_page_id = $this->factory->post->create(
     121            array(
     122                'post_title' => 'blog-page',
     123                'post_type'  => 'page',
     124            )
     125        );
    108126        update_option( 'show_on_front', 'page' );
    109127        update_option( 'page_for_posts', $blog_page_id );
     
    166184
    167185    function test_post_type_archive_title() {
    168         register_post_type( 'cpt', array(
    169             'public'      => true,
    170             'has_archive' => true,
    171             'labels'      => array(
    172                 'name' => 'test_cpt',
    173             ),
    174         ) );
    175 
    176         $this->factory->post->create( array(
    177             'post_type' => 'cpt',
    178         ) );
     186        register_post_type(
     187            'cpt', array(
     188                'public'      => true,
     189                'has_archive' => true,
     190                'labels'      => array(
     191                    'name' => 'test_cpt',
     192                ),
     193            )
     194        );
     195
     196        $this->factory->post->create(
     197            array(
     198                'post_type' => 'cpt',
     199            )
     200        );
    179201
    180202        $this->go_to( '?post_type=cpt' );
Note: See TracChangeset for help on using the changeset viewer.