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/http/functions.php

    r41279 r42343  
    1616    function test_head_request() {
    1717        // this url give a direct 200 response
    18         $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
     18        $url      = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
    1919        $response = wp_remote_head( $url );
    20         $headers = wp_remote_retrieve_headers( $response );
     20        $headers  = wp_remote_retrieve_headers( $response );
    2121
    2222        $this->assertInternalType( 'array', $response );
    23        
     23
    2424        $this->assertEquals( 'image/jpeg', $headers['content-type'] );
    2525        $this->assertEquals( '40148', $headers['content-length'] );
     
    2929    function test_head_redirect() {
    3030        // this url will 301 redirect
    31         $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     31        $url      = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
    3232        $response = wp_remote_head( $url );
    3333        $this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
     
    3535
    3636    function test_head_404() {
    37         $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
     37        $url     = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
    3838        $headers = wp_remote_head( $url );
    3939
     
    4545
    4646        $response = wp_remote_get( $url );
    47         $headers = wp_remote_retrieve_headers( $response );
     47        $headers  = wp_remote_retrieve_headers( $response );
    4848
    4949        $this->assertInternalType( 'array', $response );
    50    
     50
    5151        // should return the same headers as a head request
    5252        $this->assertEquals( 'image/jpeg', $headers['content-type'] );
     
    6060
    6161        $response = wp_remote_get( $url );
    62         $headers = wp_remote_retrieve_headers( $response );
     62        $headers  = wp_remote_retrieve_headers( $response );
    6363
    6464        // should return the same headers as a head request
     
    109109        $url = 'http://example.org';
    110110
    111         $response = wp_remote_get( $url, array(
    112             'cookies' => array(
    113                 new WP_Http_Cookie( array( 'name' => 'test', 'value' => 'foo' ) ),
    114             ),
    115         ) );
     111        $response = wp_remote_get(
     112            $url, array(
     113                'cookies' => array(
     114                    new WP_Http_Cookie(
     115                        array(
     116                            'name'  => 'test',
     117                            'value' => 'foo',
     118                        )
     119                    ),
     120                ),
     121            )
     122        );
    116123        $cookies  = wp_remote_retrieve_cookies( $response );
    117124
     
    130137        $url = 'http://example.org';
    131138
    132         $response = wp_remote_get( $url, array(
    133             'cookies' => array(
    134                 'test' => 'foo',
    135             ),
    136         ) );
     139        $response = wp_remote_get(
     140            $url, array(
     141                'cookies' => array(
     142                    'test' => 'foo',
     143                ),
     144            )
     145        );
    137146        $cookies  = wp_remote_retrieve_cookies( $response );
    138147
Note: See TracChangeset for help on using the changeset viewer.