You appear to be a bot. Output may be restricted
Description
Usage
Tests_HTTP_HTTP::make_absolute_url_testcases();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/http/http.php
Lines:
1 to 51 of 51
public function make_absolute_url_testcases() { // 0: The Location header, 1: The current URL, 3: The expected URL. return array( // Absolute URL provided. array( 'http://site.com/', 'http://example.com/', 'http://site.com/' ), // No current URL provided. array( '/location', '', '/location' ), // No location provided. array( '', 'http://example.com', 'http://example.com/' ), // Location provided relative to site root. array( '/root-relative-link.ext', 'http://example.com/', 'http://example.com/root-relative-link.ext' ), array( '/root-relative-link.ext?with=query', 'http://example.com/index.ext?query', 'http://example.com/root-relative-link.ext?with=query' ), // Location provided relative to current file/directory. array( 'relative-file.ext', 'http://example.com/', 'http://example.com/relative-file.ext' ), array( 'relative-file.ext', 'http://example.com/filename', 'http://example.com/relative-file.ext' ), array( 'relative-file.ext', 'http://example.com/directory/', 'http://example.com/directory/relative-file.ext' ), // Location provided relative to current file/directory but in a parent directory. array( '../file-in-parent.ext', 'http://example.com', 'http://example.com/file-in-parent.ext' ), array( '../file-in-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-parent.ext' ), array( '../file-in-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-parent.ext' ), array( '../file-in-parent.ext', 'http://example.com/directory/filename', 'http://example.com/file-in-parent.ext' ), // Location provided in muliple levels higher, including impossible to reach (../ below DOCROOT). array( '../../file-in-grand-parent.ext', 'http://example.com', 'http://example.com/file-in-grand-parent.ext' ), array( '../../file-in-grand-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-grand-parent.ext' ), array( '../../file-in-grand-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-grand-parent.ext' ), array( '../../file-in-grand-parent.ext', 'http://example.com/directory/filename/', 'http://example.com/file-in-grand-parent.ext' ), array( '../../file-in-grand-parent.ext', 'http://example.com/directory1/directory2/filename', 'http://example.com/file-in-grand-parent.ext' ), // Query strings should attach, or replace existing query string. array( '?query=string', 'http://example.com', 'http://example.com/?query=string' ), array( '?query=string', 'http://example.com/file.ext', 'http://example.com/file.ext?query=string' ), array( '?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/file.ext?query=string' ), array( 'otherfile.ext?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/otherfile.ext?query=string' ), // A file with a leading dot. array( '.ext', 'http://example.com/', 'http://example.com/.ext' ), // URLs within URLs. array( '/expected', 'http://example.com/sub/http://site.com/sub/', 'http://example.com/expected' ), array( '/expected/http://site.com/sub/', 'http://example.com/', 'http://example.com/expected/http://site.com/sub/' ), // Schemeless URL's (not valid in HTTP Headers, but may be used elsewhere). array( '//example.com/sub/', 'https://example.net', 'https://example.com/sub/' ), ); }