Add helper for HTTPFileStreamer header syntax
[lhc/web/wiklou.git] / tests / phpunit / includes / filebackend / HTTPFileStreamerTest.php
1 <?php
2
3 use PHPUnit\Framework\TestCase;
4
5 class HTTPFileStreamerTest extends TestCase {
6
7 /**
8 * @covers HTTPFileStreamer::preprocessHeaders
9 * @dataProvider providePreprocessHeaders
10 */
11 public function testPreprocessHeaders( array $input, array $expectedRaw, array $expectedOpt ) {
12 list( $actualRaw, $actualOpt ) = HTTPFileStreamer::preprocessHeaders( $input );
13 $this->assertSame( $expectedRaw, $actualRaw );
14 $this->assertSame( $expectedOpt, $actualOpt );
15 }
16
17 public function providePreprocessHeaders() {
18 return [
19 [
20 [ 'Vary' => 'cookie', 'Cache-Control' => 'private' ],
21 [ 'Vary: cookie', 'Cache-Control: private' ],
22 [],
23 ],
24 [
25 [
26 'Range' => 'bytes=(123-456)',
27 'Content-Type' => 'video/mp4',
28 'If-Modified-Since' => 'Wed, 21 Oct 2015 07:28:00 GMT',
29 ],
30 [ 'Content-Type: video/mp4' ],
31 [ 'range' => 'bytes=(123-456)', 'if-modified-since' => 'Wed, 21 Oct 2015 07:28:00 GMT' ],
32 ],
33 ];
34 }
35
36 }