Import: Handle uploads with sha1 starting with 0 properly
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / wfAppendQueryTest.php
blob54e1f896e7bb134b08b974961e80286abefb8cfa
1 <?php
3 /**
4 * @group GlobalFunctions
5 * @covers ::wfAppendQuery
6 */
7 class WfAppendQueryTest extends MediaWikiTestCase {
8 /**
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() {
16 return array(
17 array(
18 'http://www.example.org/index.php',
19 '',
20 'http://www.example.org/index.php',
21 'No query'
23 array(
24 'http://www.example.org/index.php',
25 array( 'foo' => 'bar' ),
26 'http://www.example.org/index.php?foo=bar',
27 'Set query array'
29 array(
30 'http://www.example.org/index.php?foz=baz',
31 'foo=bar',
32 'http://www.example.org/index.php?foz=baz&foo=bar',
33 'Set query string'
35 array(
36 'http://www.example.org/index.php?foo=bar',
37 '',
38 'http://www.example.org/index.php?foo=bar',
39 'Empty string with query'
41 array(
42 'http://www.example.org/index.php?foo=bar',
43 array( 'baz' => 'quux' ),
44 'http://www.example.org/index.php?foo=bar&baz=quux',
45 'Add query array'
47 array(
48 'http://www.example.org/index.php?foo=bar',
49 'baz=quux',
50 'http://www.example.org/index.php?foo=bar&baz=quux',
51 'Add query string'
53 array(
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',
57 'Modify query array'
59 array(
60 'http://www.example.org/index.php?foo=bar',
61 'baz=quux&foo=baz',
62 'http://www.example.org/index.php?foo=bar&baz=quux&foo=baz',
63 'Modify query string'