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',
25 array( 'foo' => 'bar' ),
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',
43 array( 'baz' => 'quux' ),
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 array( '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',