Just methods where adding "static" to the declaration was enough, I didn't do anything with providers that used $this. Initially by search and replace. There were many mistakes which I found mostly by running the PHPStorm inspection which searches for $this usage in a static method. Later I used the PHPStorm "make static" action which avoids the more obvious mistakes. Bug: T332865 Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
36 lines
952 B
PHP
36 lines
952 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class HTTPFileStreamerTest extends TestCase {
|
|
|
|
/**
|
|
* @covers HTTPFileStreamer::preprocessHeaders
|
|
* @dataProvider providePreprocessHeaders
|
|
*/
|
|
public function testPreprocessHeaders( array $input, array $expectedRaw, array $expectedOpt ) {
|
|
[ $actualRaw, $actualOpt ] = HTTPFileStreamer::preprocessHeaders( $input );
|
|
$this->assertSame( $expectedRaw, $actualRaw );
|
|
$this->assertSame( $expectedOpt, $actualOpt );
|
|
}
|
|
|
|
public static function providePreprocessHeaders() {
|
|
return [
|
|
[
|
|
[ 'Vary' => 'cookie', 'Cache-Control' => 'private' ],
|
|
[ 'Vary: cookie', 'Cache-Control: private' ],
|
|
[],
|
|
],
|
|
[
|
|
[
|
|
'Range' => 'bytes=(123-456)',
|
|
'Content-Type' => 'video/mp4',
|
|
'If-Modified-Since' => 'Wed, 21 Oct 2015 07:28:00 GMT',
|
|
],
|
|
[ 'Content-Type: video/mp4' ],
|
|
[ 'range' => 'bytes=(123-456)', 'if-modified-since' => 'Wed, 21 Oct 2015 07:28:00 GMT' ],
|
|
],
|
|
];
|
|
}
|
|
|
|
}
|