tests/FileStreamerTest.php
/**
     * Test if the correct data is being served according to the requested range.
     *
     * @dataProvider provideValidRanges
     *
     * @param   string  $RequestedRange   A valid range.
     * @param   array   $expectedRange    Unused.
     * @param   string  $expectedOutput   Expected content which is sent to the outputbuffer.
     * @param   array   $expectedHeaders  Expected headers which are sent to the outputbuffer.
     *
     * @return void
     */
Test if the correct data is being served according to the requested range.

@param   string  $RequestedRange   A valid range.
@param   array   $expectedRange    Unused.
@param   string  $expectedOutput   Expected content which is sent to the outputbuffer.
@param   array   $expectedHeaders  Expected headers which are sent to the outputbuffer.

@return void
Test if the correct data is being served according to the requested range . @param string $RequestedRange A valid range . @param array $expectedRange Unused . @param string $expectedOutput Expected content which is sent to the outputbuffer . @param array $expectedHeaders Expected headers which are sent to the outputbuffer . @return void
public function testStartSingleRange(
        string $RequestedRange,
        array $expectedRange,
        string $expectedOutput,
        array $expectedHeaders
    ): void {
        if ($this->dataName() == 'multiRange') {
            $this->markTestSkipped('Test skipped.');
        }
        $_SERVER['HTTP_RANGE'] = $RequestedRange;
        $expectedHeaders       = array_merge(self::defaultHeaders, $expectedHeaders);
        $mock = $this->mockFileStreamer();
        try {
            @$mock->start();
            $this->fail();
        } catch (Exception $e) {
            $this->assertSame($expectedOutput, Output::getBody());
            $this->assertSame($expectedHeaders, Output::$headers);
        }
    }
public function testStartSingleRange ( string $ RequestedRange , array $ expectedRange , string $ expectedOutput , array $ expectedHeaders ) : void { if ( $ this -> dataName ( ) == 'multiRange' ) { $ this -> markTestSkipped ( 'Test skipped.' ) ; } $ _SERVER [ 'HTTP_RANGE' ] = $ RequestedRange ; $ expectedHeaders = array_merge ( self :: defaultHeaders , $ expectedHeaders ) ; $ mock = $ this -> mockFileStreamer ( ) ; try { @ $ mock -> start ( ) ; $ this -> fail ( ) ; } catch ( Exception $ e ) { $ this -> assertSame ( $ expectedOutput , Output :: getBody ( ) ) ; $ this -> assertSame ( $ expectedHeaders , Output :: $ headers ) ; } }
Test if the correct data is being served according to the requested range.
Test if the correct data is being served according to the requested range .
// Skip multi-range dataset. // Get a mocked instance of the class with overridden terminate method. /** @var FileStreamer $mock */ // Suppress warning or method will be aborted.