MediaWiki REL1_32
wfAppendQueryTest.php
Go to the documentation of this file.
1<?php
2
11 public function testAppendQuery( $url, $query, $expected, $message = null ) {
12 $this->assertEquals( $expected, wfAppendQuery( $url, $query ), $message );
13 }
14
15 public static function provideAppendQuery() {
16 return [
17 [
18 'http://www.example.org/index.php',
19 '',
20 'http://www.example.org/index.php',
21 'No query'
22 ],
23 [
24 'http://www.example.org/index.php',
25 [ 'foo' => 'bar' ],
26 'http://www.example.org/index.php?foo=bar',
27 'Set query array'
28 ],
29 [
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'
34 ],
35 [
36 'http://www.example.org/index.php?foo=bar',
37 '',
38 'http://www.example.org/index.php?foo=bar',
39 'Empty string with query'
40 ],
41 [
42 'http://www.example.org/index.php?foo=bar',
43 [ 'baz' => 'quux' ],
44 'http://www.example.org/index.php?foo=bar&baz=quux',
45 'Add query array'
46 ],
47 [
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'
52 ],
53 [
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',
57 'Modify query array'
58 ],
59 [
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'
64 ],
65 [
66 'http://www.example.org/index.php#baz',
67 'foo=bar',
68 'http://www.example.org/index.php?foo=bar#baz',
69 'URL with fragment'
70 ],
71 [
72 'http://www.example.org/index.php?foo=bar#baz',
73 'quux=blah',
74 'http://www.example.org/index.php?foo=bar&quux=blah#baz',
75 'URL with query string and fragment'
76 ]
77 ];
78 }
79}
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
GlobalFunctions wfAppendQuery.
testAppendQuery( $url, $query, $expected, $message=null)
provideAppendQuery
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1656