MediaWiki REL1_32
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}
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:1873
$header