Make WordPress Core


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

    r38398 r42343  
    2323                require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
    2424                $GLOBALS['wp_customize'] = new WP_Customize_Manager();
    25                 $this->manager = $GLOBALS['wp_customize'];
    26                 $this->undefined = new stdClass();
     25                $this->manager           = $GLOBALS['wp_customize'];
     26                $this->undefined         = new stdClass();
    2727        }
    2828
     
    5656        function test_construct_custom_args() {
    5757                $args = array(
    58                         'priority' => 200,
    59                         'capability' => 'edit_posts',
    60                         'theme_supports' => 'html5',
    61                         'title' => 'Hello World',
    62                         'description' => 'Lorem Ipsum',
    63                         'type' => 'horizontal',
     58                        'priority'        => 200,
     59                        'capability'      => 'edit_posts',
     60                        'theme_supports'  => 'html5',
     61                        'title'           => 'Hello World',
     62                        'description'     => 'Lorem Ipsum',
     63                        'type'            => 'horizontal',
    6464                        'active_callback' => '__return_true',
    65                         'panel' => 'bar',
     65                        'panel'           => 'bar',
    6666                );
    6767
     
    9090                $this->assertTrue( $section->active() );
    9191
    92                 $section = new WP_Customize_Section( $this->manager, 'foo', array(
    93                         'active_callback' => '__return_false',
    94                 ) );
     92                $section = new WP_Customize_Section(
     93                        $this->manager, 'foo', array(
     94                                'active_callback' => '__return_false',
     95                        )
     96                );
    9597                $this->assertFalse( $section->active() );
    9698                add_filter( 'customize_section_active', array( $this, 'filter_active_test' ), 10, 2 );
     
    115117        function test_json() {
    116118                $args = array(
    117                         'priority' => 200,
    118                         'capability' => 'edit_posts',
    119                         'theme_supports' => 'html5',
    120                         'title' => 'Hello World',
    121                         'description' => 'Lorem Ipsum',
    122                         'type' => 'horizontal',
    123                         'panel' => 'bar',
     119                        'priority'        => 200,
     120                        'capability'      => 'edit_posts',
     121                        'theme_supports'  => 'html5',
     122                        'title'           => 'Hello World',
     123                        'description'     => 'Lorem Ipsum',
     124                        'type'            => 'horizontal',
     125                        'panel'           => 'bar',
    124126                        'active_callback' => '__return_true',
    125127                );
     
    128130
    129131                $section = new WP_Customize_Section( $this->manager, 'foo', $args );
    130                 $data = $section->json();
     132                $data    = $section->json();
    131133                $this->assertEquals( 'foo', $data['id'] );
    132134                foreach ( array( 'title', 'description', 'priority', 'panel', 'type' ) as $key ) {
     
    146148                $section = new WP_Customize_Section( $this->manager, 'foo' );
    147149                $this->assertTrue( $section->check_capabilities() );
    148                 $old_cap = $section->capability;
     150                $old_cap             = $section->capability;
    149151                $section->capability = 'do_not_allow';
    150152                $this->assertFalse( $section->check_capabilities() );
     
    168170        function test_maybe_render() {
    169171                wp_set_current_user( self::$admin_id );
    170                 $section = new WP_Customize_Section( $this->manager, 'bar' );
     172                $section                        = new WP_Customize_Section( $this->manager, 'bar' );
    171173                $customize_render_section_count = did_action( 'customize_render_section' );
    172174                add_action( 'customize_render_section', array( $this, 'action_customize_render_section_test' ) );
Note: See TracChangeset for help on using the changeset viewer.