3 * @covers ::wfAssembleUrl
5 class WfAssembleUrlTest
extends MediaWikiTestCase
{
7 * @dataProvider provideURLParts
9 public function testWfAssembleUrl( $parts, $output ) {
10 $partsDump = print_r( $parts, true );
13 wfAssembleUrl( $parts ),
14 "Testing $partsDump assembles to $output"
19 * Provider of URL parts for testing wfAssembleUrl()
23 public static function provideURLParts() {
37 'example.com' => array(
38 'host' => 'example.com',
40 'example.com:123' => array(
41 'host' => 'example.com',
44 'id@example.com' => array(
46 'host' => 'example.com',
48 'id@example.com:123' => array(
50 'host' => 'example.com',
53 'id:key@example.com' => array(
56 'host' => 'example.com',
58 'id:key@example.com:123' => array(
61 'host' => 'example.com',
67 foreach ( $schemes as $scheme => $schemeParts ) {
68 foreach ( $hosts as $host => $hostParts ) {
69 foreach ( array( '', '/path' ) as $path ) {
70 foreach ( array( '', 'query' ) as $query ) {
71 foreach ( array( '', 'fragment' ) as $fragment ) {
81 $parts['path'] = $path;
84 $parts['query'] = $query;
88 $parts['fragment'] = $fragment;
89 $url .= '#' . $fragment;
102 $complexURL = 'http://id:key@example.org:321' .
103 '/over/there?name=ferret&foo=bar#nose';
105 wfParseUrl( $complexURL ),