You appear to be a bot. Output may be restricted
Description
Usage
Tests_HTTP_HTTP::parse_url_testcases();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/http/http.php
Lines:
1 to 100 of 103
public function parse_url_testcases() { // 0: The URL, 1: The expected resulting structure. return array( array( self::FULL_TEST_URL, array( 'scheme' => 'http', 'host' => 'host.name', 'port' => 9090, 'user' => 'username', 'pass' => 'password', 'path' => '/path', 'query' => 'arg1=value1&arg2=value2', 'fragment' => 'anchor', ), ), array( 'http://example.com/', array( 'scheme' => 'http', 'host' => 'example.com', 'path' => '/', ), ), // < PHP 5.4.7: Schemeless URL. array( '//example.com/path/', array( 'host' => 'example.com', 'path' => '/path/', ), ), array( '//example.com/', array( 'host' => 'example.com', 'path' => '/', ), ), array( 'http://example.com//path/', array( 'scheme' => 'http', 'host' => 'example.com', 'path' => '//path/', ), ), // < PHP 5.4.7: Scheme separator in the URL. array( 'http://example.com/http://example.net/', array( 'scheme' => 'http', 'host' => 'example.com', 'path' => '/http://example.net/', ), ), array( '/path/http://example.net/', array( 'path' => '/path/http://example.net/' ) ), // < PHP 5.4.7: IPv6 literals in schemeless URLs are handled incorrectly. array( '//[::FFFF::127.0.0.1]/', array( 'host' => '[::FFFF::127.0.0.1]', 'path' => '/', ), ), // PHP's parse_url() calls this an invalid url, we handle it as a path. array( '/://example.com/', array( 'path' => '/://example.com/' ) ), // Schemeless URL containing colons cause parse errors in PHP 7+. array( '//fonts.googleapis.com/css?family=Open+Sans:400&subset=latin', array( 'host' => 'fonts.googleapis.com', 'path' => '/css', 'query' => 'family=Open+Sans:400&subset=latin', ), ), array( '//fonts.googleapis.com/css?family=Open+Sans:400', array( 'host' => 'fonts.googleapis.com', 'path' => '/css', 'query' => 'family=Open+Sans:400', ), ), array( 'filenamefound', array( 'path' => 'filenamefound' ) ), // Empty string or non-string passed in. array( '', array( 'path' => '' ) ), array( 123, array( 'path' => '123' ) ), ); /* * Untestable edge cases in various PHP: * - ///example.com - Fails in PHP >= 5.4.7, assumed path in <5.4.7 * - ://example.com - assumed path in PHP >= 5.4.7, fails in <5.4.7 */