Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 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/functions.php

    r46966 r47122  
    2323
    2424        function test_wp_parse_args_array() {
    25                 // arrays
     25                // Arrays.
    2626                $a = array();
    2727                $this->assertEquals( array(), wp_parse_args( $a ) );
    … …  
    141141        function data_wp_normalize_path() {
    142142                return array(
    143                         // Windows paths
     143                        // Windows paths.
    144144                        array( 'C:\\www\\path\\', 'C:/www/path/' ),
    145145                        array( 'C:\\www\\\\path\\', 'C:/www/path/' ),
    146146                        array( 'c:/www/path', 'C:/www/path' ),
    147                         array( 'c:\\www\\path\\', 'C:/www/path/' ), // uppercase drive letter
     147                        array( 'c:\\www\\path\\', 'C:/www/path/' ), // Uppercase drive letter.
    148148                        array( 'c:\\\\www\\path\\', 'C:/www/path/' ),
    149149                        array( '\\\\Domain\\DFSRoots\\share\\path\\', '//Domain/DFSRoots/share/path/' ),
    … …  
    151151                        array( '\\\\Server\\share', '//Server/share' ),
    152152
    153                         // Linux paths
     153                        // Linux paths.
    154154                        array( '/www/path/', '/www/path/' ),
    155155                        array( '/www/path/////', '/www/path/' ),
    156156                        array( '/www/path', '/www/path' ),
    157157
    158                         // PHP Stream wrappers
     158                        // PHP stream wrappers.
    159159                        array( 'php://input', 'php://input' ),
    160160                        array( 'http://example.com//path.ext', 'http://example.com/path.ext' ),
    … …  
    167167                $testdir = DIR_TESTDATA . '/images/';
    168168
    169                 // sanity check
     169                // Sanity check.
    170170                $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcdefg.png' ), 'Sanitiy check failed' );
    171171
    172                 // check number is appended for file already exists
     172                // Check number is appended for file already exists.
    173173                $this->assertFileExists( $testdir . 'test-image.png', 'Test image does not exist' );
    174174                $this->assertEquals( 'test-image-1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' );
    175175                $this->assertFileNotExists( $testdir . 'test-image-1.png' );
    176176
    177                 // check special chars
     177                // Check special chars.
    178178                $this->assertEquals( 'testtést-imagé.png', wp_unique_filename( $testdir, 'testtést-imagé.png' ), 'Filename with special chars failed' );
    179179
    180                 // check special chars with potential conflicting name
     180                // Check special chars with potential conflicting name.
    181181                $this->assertEquals( 'tést-imagé.png', wp_unique_filename( $testdir, 'tést-imagé.png' ), 'Filename with special chars failed' );
    182182
    183                 // check with single quotes in name (somehow)
     183                // Check with single quotes in name (somehow).
    184184                $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' );
    185185
    186                 // check with single quotes in name (somehow)
     186                // Check with double quotes in name (somehow).
    187187                $this->assertEquals( 'abcdefgh.png', wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
    188188
    189                 // test crazy name (useful for regression tests)
     189                // Test crazy name (useful for regression tests).
    190190                $this->assertEquals( '12af34567890@..^_qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty  fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' );
    191191
    192                 // test slashes in names
     192                // Test slashes in names.
    193193                $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' );
    194194                $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\fg.png' ), 'Double slashed not removed' );
    … …  
    526526                $this->assertNotEmpty( $mimes );
    527527
    528                 // upload_mimes shouldn't affect wp_get_mime_types()
     528                // 'upload_mimes' should not affect wp_get_mime_types().
    529529                add_filter( 'upload_mimes', '__return_empty_array' );
    530530                $mimes = wp_get_mime_types();
    … …  
    647647        function data_device_can_upload() {
    648648                return array(
    649                         // iPhone iOS 5.0.1, Safari 5.1
     649                        // iPhone iOS 5.0.1, Safari 5.1.
    650650                        array(
    651651                                'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A406)',
    652652                                false,
    653653                        ),
    654                         // iPad iOS 3.2, Safari 4.0.4
     654                        // iPad iOS 3.2, Safari 4.0.4.
    655655                        array(
    656656                                'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10',
    657657                                false,
    658658                        ),
    659                         // iPod iOS 4.3.3, Safari 5.0.2
     659                        // iPod iOS 4.3.3, Safari 5.0.2.
    660660                        array(
    661661                                'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5',
    662662                                false,
    663663                        ),
    664                         // iPhone iOS 6.0.0, Safari 6.0
     664                        // iPhone iOS 6.0.0, Safari 6.0.
    665665                        array(
    666666                                'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
    667667                                true,
    668668                        ),
    669                         // iPad iOS 6.0.0, Safari 6.0
     669                        // iPad iOS 6.0.0, Safari 6.0.
    670670                        array(
    671671                                'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
    672672                                true,
    673673                        ),
    674                         // Android 2.2, Android Webkit Browser
     674                        // Android 2.2, Android Webkit Browser.
    675675                        array(
    676676                                'Mozilla/5.0 (Android 2.2; Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4',
    677677                                true,
    678678                        ),
    679                         // BlackBerry 9900, BlackBerry browser
     679                        // BlackBerry 9900, BlackBerry browser.
    680680                        array(
    681681                                'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+',
    682682                                true,
    683683                        ),
    684                         // Windows Phone 8.0, Internet Explorer 10.0;
     684                        // Windows Phone 8.0, Internet Explorer 10.0.
    685685                        array(
    686686                                'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)',
    687687                                true,
    688688                        ),
    689                         // Ubuntu desktop, Firefox 41.0
     689                        // Ubuntu desktop, Firefox 41.0.
    690690                        array(
    691691                                'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0',
    … …  
    717717                        'http://تشادر.icom.museum',
    718718                        'http://中国.icom.museum',
    719                         #'http://القمر.icom.museum', // Comoros http://القمر.icom.museum
    720                         #'http://κυπρος.icom.museum', Cyprus    http://κυπρος.icom.museum
     719                        // 'http://القمر.icom.museum',         // Comoros http://القمر.icom.museum
     720                        // 'http://κυπρος.icom.museum',        // Cyprus  http://κυπρος.icom.museum
    721721                        'http://českárepublika.icom.museum',
    722                         #'http://مصر.icom.museum', // Egypt     http://مصر.icom.museum
     722                        // 'http://مصر.icom.museum',           // Egypt   http://مصر.icom.museum
    723723                        'http://ελλάδα.icom.museum',
    724724                        'http://magyarország.icom.museum',
    … …  
    736736                        'http://لبنان.icom.museum',
    737737                        'http://македонија.icom.museum',
    738                         #'http://موريتانيا.icom.museum', // Mauritania  http://موريتانيا.icom.museum
     738                        // 'http://موريتانيا.icom.museum',     // Mauritania http://موريتانيا.icom.museum
    739739                        'http://méxico.icom.museum',
    740740                        'http://монголулс.icom.museum',
    741                         #'http://المغرب.icom.museum', // Morocco        http://المغرب.icom.museum
     741                        // 'http://المغرب.icom.museum',        // Morocco    http://المغرب.icom.museum
    742742                        'http://नेपाल.icom.museum',
    743                         #'http://عمان.icom.museum', // Oman     http://عمان.icom.museum
     743                        // 'http://عمان.icom.museum',          // Oman       http://عمان.icom.museum
    744744                        'http://قطر.icom.museum',
    745745                        'http://românia.icom.museum',
    … …  
    827827
    828828                $exploded = array_values( array_filter( array_map( 'trim', explode( "\n", $blob ) ) ) );
    829                 // wp_extract_urls calls html_entity_decode
     829                // wp_extract_urls() calls html_entity_decode().
    830830                $decoded = array_map( 'html_entity_decode', $exploded );
    831831
    … …  
    16651665                        array( '00', false ),
    16661666                        array( '30:-10', false ),
    1667                         array( ':30:00', false ), // Missing HH.
     1667                        array( ':30:00', false ),   // Missing HH.
    16681668                        array( 'MM:30:00', false ), // Invalid HH.
    16691669                        array( '30:MM:00', false ), // Invalid ii.
    16701670                        array( '30:30:MM', false ), // Invalid ss.
    1671                         array( '30:MM', false ), // Invalid ss.
    1672                         array( 'MM:00', false ), // Invalid ii.
    1673                         array( 'MM:MM', false ), // Invalid ii and ss.
    1674                         array( '10 :30', false ), // Containing a space.
    1675                         array( '59:61', false ), // Out of bound.
    1676                         array( '61:59', false ), // Out of bound.
    1677                         array( '3:59:61', false ), // Out of bound.
     1671                        array( '30:MM', false ),    // Invalid ss.
     1672                        array( 'MM:00', false ),    // Invalid ii.
     1673                        array( 'MM:MM', false ),    // Invalid ii and ss.
     1674                        array( '10 :30', false ),   // Containing a space.
     1675                        array( '59:61', false ),    // Out of bound.
     1676                        array( '61:59', false ),    // Out of bound.
     1677                        array( '3:59:61', false ),  // Out of bound.
    16781678                        array( '03:61:59', false ), // Out of bound.
    16791679                );
Note: See TracChangeset for help on using the changeset viewer.