4 * @group GlobalFunctions
5 * @covers ::wfAppendQuery
7 class WfAppendQueryTest
extends MediaWikiTestCase
{
9 * @dataProvider provideAppendQuery
11 public function testAppendQuery( $url, $query, $expected, $message = null ) {
12 $this->assertEquals( $expected, wfAppendQuery( $url, $query ), $message );
15 public static function provideAppendQuery() {
18 'http://www.example.org/index.php',
20 'http://www.example.org/index.php',
24 'http://www.example.org/index.php',
26 'http://www.example.org/index.php?foo=bar',
30 'http://www.example.org/index.php?foz=baz',
32 'http://www.example.org/index.php?foz=baz&foo=bar',
36 'http://www.example.org/index.php?foo=bar',
38 'http://www.example.org/index.php?foo=bar',
39 'Empty string with query'
42 'http://www.example.org/index.php?foo=bar',
44 'http://www.example.org/index.php?foo=bar&baz=quux',
48 'http://www.example.org/index.php?foo=bar',
50 'http://www.example.org/index.php?foo=bar&baz=quux',
54 'http://www.example.org/index.php?foo=bar',
55 [ 'baz' => 'quux', 'foo' => 'baz' ],
56 'http://www.example.org/index.php?foo=bar&baz=quux&foo=baz',
60 'http://www.example.org/index.php?foo=bar',
62 'http://www.example.org/index.php?foo=bar&baz=quux&foo=baz',
66 'http://www.example.org/index.php#baz',
68 'http://www.example.org/index.php?foo=bar#baz',
72 'http://www.example.org/index.php?foo=bar#baz',
74 'http://www.example.org/index.php?foo=bar&quux=blah#baz',
75 'URL with query string and fragment'