3 * @group GlobalFunctions
4 * @covers ::wfAssembleUrl
6 class WfAssembleUrlTest
extends MediaWikiTestCase
{
8 * @dataProvider provideURLParts
10 public function testWfAssembleUrl( $parts, $output ) {
11 $partsDump = print_r( $parts, true );
14 wfAssembleUrl( $parts ),
15 "Testing $partsDump assembles to $output"
20 * Provider of URL parts for testing wfAssembleUrl()
24 public static function provideURLParts() {
38 'example.com' => array(
39 'host' => 'example.com',
41 'example.com:123' => array(
42 'host' => 'example.com',
45 'id@example.com' => array(
47 'host' => 'example.com',
49 'id@example.com:123' => array(
51 'host' => 'example.com',
54 'id:key@example.com' => array(
57 'host' => 'example.com',
59 'id:key@example.com:123' => array(
62 'host' => 'example.com',
68 foreach ( $schemes as $scheme => $schemeParts ) {
69 foreach ( $hosts as $host => $hostParts ) {
70 foreach ( array( '', '/path' ) as $path ) {
71 foreach ( array( '', 'query' ) as $query ) {
72 foreach ( array( '', 'fragment' ) as $fragment ) {
82 $parts['path'] = $path;
85 $parts['query'] = $query;
89 $parts['fragment'] = $fragment;
90 $url .= '#' . $fragment;
103 $complexURL = 'http://id:key@example.org:321' .
104 '/over/there?name=ferret&foo=bar#nose';
106 wfParseUrl( $complexURL ),