Make WordPress Core


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

    r41806 r42343  
    99
    1010        $default_headers = array(
    11             'Name' => 'Hello Dolly',
    12             'Title' => '<a href="http://wordpress.org/#">Hello Dolly</a>',
    13             'PluginURI' => 'http://wordpress.org/#',
     11            'Name'        => 'Hello Dolly',
     12            'Title'       => '<a href="http://wordpress.org/#">Hello Dolly</a>',
     13            'PluginURI'   => 'http://wordpress.org/#',
    1414            'Description' => 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. <cite>By <a href="http://ma.tt/">Matt Mullenweg</a>.</cite>',
    15             'Author' => '<a href="http://ma.tt/">Matt Mullenweg</a>',
    16             'AuthorURI' => 'http://ma.tt/',
    17             'Version' => '1.5.1',
    18             'TextDomain' => 'hello-dolly',
    19             'DomainPath' => ''
     15            'Author'      => '<a href="http://ma.tt/">Matt Mullenweg</a>',
     16            'AuthorURI'   => 'http://ma.tt/',
     17            'Version'     => '1.5.1',
     18            'TextDomain'  => 'hello-dolly',
     19            'DomainPath'  => '',
    2020        );
    2121
    22         $this->assertTrue( is_array($data) );
    23 
    24         foreach ($default_headers as $name => $value) {
    25             $this->assertTrue(isset($data[$name]));
    26             $this->assertEquals($value, $data[$name]);
     22        $this->assertTrue( is_array( $data ) );
     23
     24        foreach ( $default_headers as $name => $value ) {
     25            $this->assertTrue( isset( $data[ $name ] ) );
     26            $this->assertEquals( $value, $data[ $name ] );
    2727        }
    2828    }
     
    4242        add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
    4343
    44         $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
    45         $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
     44        $expected['testsettings']        = 'http://example.com/wp-admin/options-general.php?page=testsettings';
     45        $expected['testtools']           = 'http://example.com/wp-admin/tools.php?page=testtools';
    4646        $expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
    47         $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
    48         $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
    49         $expected['not_registered'] = '';
    50         $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=With%20Spaces';
    51         $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&#038;page=testpages';
    52 
    53         foreach ($expected as $name => $value) {
     47        $expected['sub-page']            = 'http://example.com/wp-admin/admin.php?page=sub-page';
     48        $expected['sub-page2']           = 'http://example.com/wp-admin/admin.php?page=sub-page2';
     49        $expected['not_registered']      = '';
     50        $expected['With Spaces']         = 'http://example.com/wp-admin/themes.php?page=With%20Spaces';
     51        $expected['testpages']           = 'http://example.com/wp-admin/edit.php?post_type=page&#038;page=testpages';
     52
     53        foreach ( $expected as $name => $value ) {
    5454            $this->assertEquals( $value, menu_page_url( $name, false ) );
    5555        }
     
    100100        $plugin_dir = WP_PLUGIN_DIR . '/list_files_test_plugin';
    101101        @mkdir( $plugin_dir );
    102         $plugin = $this->_create_plugin(null, 'list_files_test_plugin.php', $plugin_dir );
     102        $plugin = $this->_create_plugin( null, 'list_files_test_plugin.php', $plugin_dir );
    103103
    104104        $sub_dir = trailingslashit( dirname( $plugin[1] ) ) . 'subdir';
     
    107107
    108108        $plugin_files = get_plugin_files( plugin_basename( $plugin[1] ) );
    109         $expected = array(
     109        $expected     = array(
    110110            'list_files_test_plugin/list_files_test_plugin.php',
    111111            'list_files_test_plugin/subdir/subfile.php',
     
    321321        $plugin = $this->_create_plugin();
    322322
    323         activate_plugin( $plugin[ 0 ] );
    324         unlink( $plugin[ 1 ] );
     323        activate_plugin( $plugin[0] );
     324        unlink( $plugin[1] );
    325325
    326326        $result = validate_active_plugins();
    327         $this->assertTrue( isset( $result[ $plugin[ 0 ] ] ) );
     327        $this->assertTrue( isset( $result[ $plugin[0] ] ) );
    328328    }
    329329
     
    348348        $plugin = $this->_create_plugin();
    349349
    350         $uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
     350        $uninstallable_plugins               = (array) get_option( 'uninstall_plugins' );
    351351        $uninstallable_plugins[ $plugin[0] ] = true;
    352352        update_option( 'uninstall_plugins', $uninstallable_plugins );
     
    431431     */
    432432    private function _restore_mu_plugins() {
    433         $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup';
     433        $mu_bu_dir     = WP_CONTENT_DIR . '/mu-plugin-backup';
    434434        $files_to_move = array();
    435435        if ( is_dir( $mu_bu_dir ) && $mu_plugins = opendir( $mu_bu_dir ) ) {
     
    465465        }
    466466
    467         foreach( _get_dropins() as $file_to_move => $v ) {
     467        foreach ( _get_dropins() as $file_to_move => $v ) {
    468468            if ( file_exists( WP_CONTENT_DIR . '/' . $file_to_move ) ) {
    469469                rename( WP_CONTENT_DIR . '/' . $file_to_move, $di_bu_dir . '/' . $file_to_move );
     
    482482        $di_bu_dir = WP_CONTENT_DIR . '/drop-ins-backup';
    483483
    484         foreach( _get_dropins() as $file_to_move => $v ) {
     484        foreach ( _get_dropins() as $file_to_move => $v ) {
    485485            if ( file_exists( $di_bu_dir . '/' . $file_to_move ) ) {
    486486                rename( $di_bu_dir . '/' . $file_to_move, WP_CONTENT_DIR . '/' . $file_to_move );
Note: See TracChangeset for help on using the changeset viewer.