Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/http/http.php

    r46586 r47122  
    1818
    1919    function make_absolute_url_testcases() {
    20         // 0: The Location header, 1: The current url, 3: The expected url
    21         return array(
    22             array( 'http://site.com/', 'http://example.com/', 'http://site.com/' ), // Absolute URL provided
    23             array( '/location', '', '/location' ), // No current url provided
    24 
    25             array( '', 'http://example.com', 'http://example.com/' ), // No location provided
    26 
    27             // Location provided relative to site root
     20        // 0: The Location header, 1: The current URL, 3: The expected URL.
     21        return array(
     22            // Absolute URL provided.
     23            array( 'http://site.com/', 'http://example.com/', 'http://site.com/' ),
     24            // No current URL provided.
     25            array( '/location', '', '/location' ),
     26
     27            // No location provided.
     28            array( '', 'http://example.com', 'http://example.com/' ),
     29
     30            // Location provided relative to site root.
    2831            array( '/root-relative-link.ext', 'http://example.com/', 'http://example.com/root-relative-link.ext' ),
    2932            array( '/root-relative-link.ext?with=query', 'http://example.com/index.ext?query', 'http://example.com/root-relative-link.ext?with=query' ),
    3033
    31             // Location provided relative to current file/directory
     34            // Location provided relative to current file/directory.
    3235            array( 'relative-file.ext', 'http://example.com/', 'http://example.com/relative-file.ext' ),
    3336            array( 'relative-file.ext', 'http://example.com/filename', 'http://example.com/relative-file.ext' ),
    3437            array( 'relative-file.ext', 'http://example.com/directory/', 'http://example.com/directory/relative-file.ext' ),
    3538
    36             // Location provided relative to current file/directory but in a parent directory
     39            // Location provided relative to current file/directory but in a parent directory.
    3740            array( '../file-in-parent.ext', 'http://example.com', 'http://example.com/file-in-parent.ext' ),
    3841            array( '../file-in-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-parent.ext' ),
     
    4043            array( '../file-in-parent.ext', 'http://example.com/directory/filename', 'http://example.com/file-in-parent.ext' ),
    4144
    42             // Location provided in muliple levels higher, including impossible to reach (../ below DOCROOT)
     45            // Location provided in muliple levels higher, including impossible to reach (../ below DOCROOT).
    4346            array( '../../file-in-grand-parent.ext', 'http://example.com', 'http://example.com/file-in-grand-parent.ext' ),
    4447            array( '../../file-in-grand-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-grand-parent.ext' ),
     
    5356            array( 'otherfile.ext?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/otherfile.ext?query=string' ),
    5457
    55             // A file with a leading dot
     58            // A file with a leading dot.
    5659            array( '.ext', 'http://example.com/', 'http://example.com/.ext' ),
    5760
    58             // URls within URLs
     61            // URLs within URLs.
    5962            array( '/expected', 'http://example.com/sub/http://site.com/sub/', 'http://example.com/expected' ),
    6063            array( '/expected/http://site.com/sub/', 'http://example.com/', 'http://example.com/expected/http://site.com/sub/' ),
    6164
    62             // Schemeless URL's (Not valid in HTTP Headers, but may be used elsewhere)
     65            // Schemeless URL's (not valid in HTTP Headers, but may be used elsewhere).
    6366            array( '//example.com/sub/', 'https://example.net', 'https://example.com/sub/' ),
    6467        );
     
    7477
    7578    function parse_url_testcases() {
    76         // 0: The URL, 1: The expected resulting structure
     79        // 0: The URL, 1: The expected resulting structure.
    7780        return array(
    7881            array(
     
    98101            ),
    99102
    100             // < PHP 5.4.7: Schemeless URL
     103            // < PHP 5.4.7: Schemeless URL.
    101104            array(
    102105                '//example.com/path/',
     
    142145            ),
    143146
    144             // PHP's parse_url() calls this an invalid url, we handle it as a path
     147            // PHP's parse_url() calls this an invalid url, we handle it as a path.
    145148            array( '/://example.com/', array( 'path' => '/://example.com/' ) ),
    146149
     
    244247            array( '//fonts.googleapis.com/css?family=Open+Sans:400&subset=latin', PHP_URL_PATH, '/css' ),
    245248            array( '//fonts.googleapis.com/css?family=Open+Sans:400&subset=latin', PHP_URL_QUERY, 'family=Open+Sans:400&subset=latin' ),
    246             array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_HOST, 'fonts.googleapis.com' ), // 25
     249            array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_HOST, 'fonts.googleapis.com' ),  // 25
    247250            array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_PORT, null ),
    248             array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_PATH, '/css' ), //27
    249             array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_QUERY, 'family=Open+Sans:400' ), //28
     251            array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_PATH, '/css' ),                  // 27
     252            array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_QUERY, 'family=Open+Sans:400' ), // 28
    250253
    251254            // Empty string or non-string passed in.
     
    340343            array( 'http://example.com/', PHP_URL_HOST, 'example.com' ),
    341344            array( 'http://example.com/', PHP_URL_USER, null ),
    342             array( 'http:///example.com', -1, false ), // Malformed.
     345            array( 'http:///example.com', -1, false ),          // Malformed.
    343346            array( 'http:///example.com', PHP_URL_HOST, null ), // Malformed.
    344347        );
Note: See TracChangeset for help on using the changeset viewer.