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/customize/control.php

    r38906 r42343  
    4242    function test_check_capabilities() {
    4343        do_action( 'customize_register', $this->wp_customize );
    44         $control = new WP_Customize_Control( $this->wp_customize, 'blogname', array(
    45             'settings' => array( 'blogname' ),
    46         ) );
     44        $control = new WP_Customize_Control(
     45            $this->wp_customize, 'blogname', array(
     46                'settings' => array( 'blogname' ),
     47            )
     48        );
    4749        $this->assertTrue( $control->check_capabilities() );
    4850
    49         $control = new WP_Customize_Control( $this->wp_customize, 'blogname', array(
    50             'settings' => array( 'blogname', 'non_existing' ),
    51         ) );
     51        $control = new WP_Customize_Control(
     52            $this->wp_customize, 'blogname', array(
     53                'settings' => array( 'blogname', 'non_existing' ),
     54            )
     55        );
    5256        $this->assertFalse( $control->check_capabilities() );
    5357
    54         $this->wp_customize->add_setting( 'top_secret_message', array(
    55             'capability' => 'top_secret_clearance',
    56         ) );
    57         $control = new WP_Customize_Control( $this->wp_customize, 'blogname', array(
    58             'settings' => array( 'blogname', 'top_secret_clearance' ),
    59         ) );
     58        $this->wp_customize->add_setting(
     59            'top_secret_message', array(
     60                'capability' => 'top_secret_clearance',
     61            )
     62        );
     63        $control = new WP_Customize_Control(
     64            $this->wp_customize, 'blogname', array(
     65                'settings' => array( 'blogname', 'top_secret_clearance' ),
     66            )
     67        );
    6068        $this->assertFalse( $control->check_capabilities() );
    6169
    62         $control = new WP_Customize_Control( $this->wp_customize, 'no_setting', array(
    63             'settings' => array(),
    64         ) );
     70        $control = new WP_Customize_Control(
     71            $this->wp_customize, 'no_setting', array(
     72                'settings' => array(),
     73            )
     74        );
    6575        $this->assertTrue( $control->check_capabilities() );
    6676
    67         $control = new WP_Customize_Control( $this->wp_customize, 'no_setting', array(
    68             'settings' => array(),
    69             'capability' => 'top_secret_clearance',
    70         ) );
     77        $control = new WP_Customize_Control(
     78            $this->wp_customize, 'no_setting', array(
     79                'settings'   => array(),
     80                'capability' => 'top_secret_clearance',
     81            )
     82        );
    7183        $this->assertFalse( $control->check_capabilities() );
    7284
    73         $control = new WP_Customize_Control( $this->wp_customize, 'no_setting', array(
    74             'settings' => array(),
    75             'capability' => 'edit_theme_options',
    76         ) );
     85        $control = new WP_Customize_Control(
     86            $this->wp_customize, 'no_setting', array(
     87                'settings'   => array(),
     88                'capability' => 'edit_theme_options',
     89            )
     90        );
    7791        $this->assertTrue( $control->check_capabilities() );
    7892    }
     
    114128
    115129        // Ensure that auto-draft pages are included if they are among the nav_menus_created_posts.
    116         $auto_draft_page_id = $this->factory()->post->create( array(
    117             'post_type' => 'page',
    118             'post_status' => 'auto-draft',
    119             'post_title' => 'Auto Draft Page',
    120         ) );
    121         $this->factory()->post->create( array(
    122             'post_type' => 'page',
    123             'post_status' => 'auto-draft',
    124             'post_title' => 'Orphan Auto Draft Page',
    125         ) );
    126         $auto_draft_post_id = $this->factory()->post->create( array(
    127             'post_type' => 'post',
    128             'post_status' => 'auto-draft',
    129             'post_title' => 'Auto Draft Post',
    130         ) );
     130        $auto_draft_page_id = $this->factory()->post->create(
     131            array(
     132                'post_type'   => 'page',
     133                'post_status' => 'auto-draft',
     134                'post_title'  => 'Auto Draft Page',
     135            )
     136        );
     137        $this->factory()->post->create(
     138            array(
     139                'post_type'   => 'page',
     140                'post_status' => 'auto-draft',
     141                'post_title'  => 'Orphan Auto Draft Page',
     142            )
     143        );
     144        $auto_draft_post_id = $this->factory()->post->create(
     145            array(
     146                'post_type'   => 'post',
     147                'post_status' => 'auto-draft',
     148                'post_title'  => 'Auto Draft Post',
     149            )
     150        );
    131151        $this->wp_customize->set_post_value( $nav_menus_created_posts_setting->id, array( $auto_draft_page_id, $auto_draft_post_id ) );
    132152        $nav_menus_created_posts_setting->preview();
Note: See TracChangeset for help on using the changeset viewer.