3 * Unit tests for wfAssembleUrl()
6 class wfAssembleUrl
extends MediaWikiTestCase
{
7 /** @dataProvider provideURLParts */
8 public function testWfAssembleUrl( $parts, $output ) {
9 $partsDump = print_r( $parts, true );
12 wfAssembleUrl( $parts ),
13 "Testing $partsDump assembles to $output"
18 * Provider of URL parts for testing wfAssembleUrl()
22 public static function provideURLParts() {
36 'example.com' => array(
37 'host' => 'example.com',
39 'example.com:123' => array(
40 'host' => 'example.com',
43 'id@example.com' => array(
45 'host' => 'example.com',
47 'id@example.com:123' => array(
49 'host' => 'example.com',
52 'id:key@example.com' => array(
55 'host' => 'example.com',
57 'id:key@example.com:123' => array(
60 'host' => 'example.com',
66 foreach ( $schemes as $scheme => $schemeParts ) {
67 foreach ( $hosts as $host => $hostParts ) {
68 foreach ( array( '', '/path' ) as $path ) {
69 foreach ( array( '', 'query' ) as $query ) {
70 foreach ( array( '', 'fragment' ) as $fragment ) {
80 $parts['path'] = $path;
83 $parts['query'] = $query;
87 $parts['fragment'] = $fragment;
88 $url .= '#' . $fragment;
102 $complexURL = 'http://id:key@example.org:321' .
103 '/over/there?name=ferret&foo=bar#nose';
105 wfParseUrl( $complexURL ),