MediaWiki REL1_33
HttpAcceptParserTest.php
Go to the documentation of this file.
1<?php
2
4
10class HttpAcceptParserTest extends \PHPUnit\Framework\TestCase {
11
12 public function provideParseWeights() {
13 return [
14 [ // #0
15 '',
16 []
17 ],
18 [ // #1
19 'Foo/Bar',
20 [ 'foo/bar' => 1 ]
21 ],
22 [ // #2
23 'Accept: text/plain',
24 [ 'text/plain' => 1 ]
25 ],
26 [ // #3
27 'Accept: application/vnd.php.serialized, application/rdf+xml',
28 [ 'application/vnd.php.serialized' => 1, 'application/rdf+xml' => 1 ]
29 ],
30 [ // #4
31 'foo; q=0.2, xoo; q=0,text/n3',
32 [ 'text/n3' => 1, 'foo' => 0.2 ]
33 ],
34 [ // #5
35 '*; q=0.2, */*; q=0.1,text/*',
36 [ 'text/*' => 1, '*' => 0.2, '*/*' => 0.1 ]
37 ],
38 // TODO: nicely ignore additional type paramerters
39 //[ // #6
40 // 'Foo; q=0.2, Xoo; level=3, Bar; charset=xyz; q=0.4',
41 // [ 'xoo' => 1, 'bar' => 0.4, 'foo' => 0.1 ]
42 //],
43 ];
44 }
45
49 public function testParseWeights( $header, $expected ) {
51 $actual = $parser->parseWeights( $header );
52
53 $this->assertEquals( $expected, $actual ); // shouldn't be sensitive to order
54 }
55
56}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Wikimedia\Http\HttpAcceptParser.
testParseWeights( $header, $expected)
provideParseWeights
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition hooks.txt:1834
$header