Changeset 47122 for trunk/tests/phpunit/tests/http/http.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/http/http.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/http/http.php
r46586 r47122 18 18 19 19 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. 28 31 array( '/root-relative-link.ext', 'http://example.com/', 'http://example.com/root-relative-link.ext' ), 29 32 array( '/root-relative-link.ext?with=query', 'http://example.com/index.ext?query', 'http://example.com/root-relative-link.ext?with=query' ), 30 33 31 // Location provided relative to current file/directory 34 // Location provided relative to current file/directory. 32 35 array( 'relative-file.ext', 'http://example.com/', 'http://example.com/relative-file.ext' ), 33 36 array( 'relative-file.ext', 'http://example.com/filename', 'http://example.com/relative-file.ext' ), 34 37 array( 'relative-file.ext', 'http://example.com/directory/', 'http://example.com/directory/relative-file.ext' ), 35 38 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. 37 40 array( '../file-in-parent.ext', 'http://example.com', 'http://example.com/file-in-parent.ext' ), 38 41 array( '../file-in-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-parent.ext' ), … … 40 43 array( '../file-in-parent.ext', 'http://example.com/directory/filename', 'http://example.com/file-in-parent.ext' ), 41 44 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). 43 46 array( '../../file-in-grand-parent.ext', 'http://example.com', 'http://example.com/file-in-grand-parent.ext' ), 44 47 array( '../../file-in-grand-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-grand-parent.ext' ), … … 53 56 array( 'otherfile.ext?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/otherfile.ext?query=string' ), 54 57 55 // A file with a leading dot 58 // A file with a leading dot. 56 59 array( '.ext', 'http://example.com/', 'http://example.com/.ext' ), 57 60 58 // UR ls within URLs61 // URLs within URLs. 59 62 array( '/expected', 'http://example.com/sub/http://site.com/sub/', 'http://example.com/expected' ), 60 63 array( '/expected/http://site.com/sub/', 'http://example.com/', 'http://example.com/expected/http://site.com/sub/' ), 61 64 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). 63 66 array( '//example.com/sub/', 'https://example.net', 'https://example.com/sub/' ), 64 67 ); … … 74 77 75 78 function parse_url_testcases() { 76 // 0: The URL, 1: The expected resulting structure 79 // 0: The URL, 1: The expected resulting structure. 77 80 return array( 78 81 array( … … 98 101 ), 99 102 100 // < PHP 5.4.7: Schemeless URL 103 // < PHP 5.4.7: Schemeless URL. 101 104 array( 102 105 '//example.com/path/', … … 142 145 ), 143 146 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. 145 148 array( '/://example.com/', array( 'path' => '/://example.com/' ) ), 146 149 … … 244 247 array( '//fonts.googleapis.com/css?family=Open+Sans:400&subset=latin', PHP_URL_PATH, '/css' ), 245 248 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' ), // 25249 array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_HOST, 'fonts.googleapis.com' ), // 25 247 250 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' ), //27249 array( '//fonts.googleapis.com/css?family=Open+Sans:400', PHP_URL_QUERY, 'family=Open+Sans:400' ), // 28251 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 250 253 251 254 // Empty string or non-string passed in. … … 340 343 array( 'http://example.com/', PHP_URL_HOST, 'example.com' ), 341 344 array( 'http://example.com/', PHP_URL_USER, null ), 342 array( 'http:///example.com', -1, false ), // Malformed.345 array( 'http:///example.com', -1, false ), // Malformed. 343 346 array( 'http:///example.com', PHP_URL_HOST, null ), // Malformed. 344 347 );
Note: See TracChangeset
for help on using the changeset viewer.