3 * Tests for wfAssembleUrl()
5 class WfAssembleUrlTest
extends MediaWikiTestCase
{
6 /** @dataProvider provideURLParts */
7 public function testWfAssembleUrl( $parts, $output ) {
8 $partsDump = print_r( $parts, true );
11 wfAssembleUrl( $parts ),
12 "Testing $partsDump assembles to $output"
17 * Provider of URL parts for testing wfAssembleUrl()
21 public static function provideURLParts() {
35 'example.com' => array(
36 'host' => 'example.com',
38 'example.com:123' => array(
39 'host' => 'example.com',
42 'id@example.com' => array(
44 'host' => 'example.com',
46 'id@example.com:123' => array(
48 'host' => 'example.com',
51 'id:key@example.com' => array(
54 'host' => 'example.com',
56 'id:key@example.com:123' => array(
59 'host' => 'example.com',
65 foreach ( $schemes as $scheme => $schemeParts ) {
66 foreach ( $hosts as $host => $hostParts ) {
67 foreach ( array( '', '/path' ) as $path ) {
68 foreach ( array( '', 'query' ) as $query ) {
69 foreach ( array( '', 'fragment' ) as $fragment ) {
79 $parts['path'] = $path;
82 $parts['query'] = $query;
86 $parts['fragment'] = $fragment;
87 $url .= '#' . $fragment;
100 $complexURL = 'http://id:key@example.org:321' .
101 '/over/there?name=ferret&foo=bar#nose';
103 wfParseUrl( $complexURL ),