tests/FileStreamerTest.php
/**
     * Test if the correct headers are set when requesting an invalid range.
     *
     * @dataProvider provideInvalidRanges
     *
     * @param   string  $RequestedRange  An invalid range.
     *
     * @return void
     */
Test if the correct headers are set when requesting an invalid range.

@param   string  $RequestedRange  An invalid range.

@return void
Test if the correct headers are set when requesting an invalid range . @param string $RequestedRange An invalid range . @return void
public function testRequestedRangesInvalid(string $RequestedRange)
    {
        $_SERVER['HTTP_RANGE'] = $RequestedRange;
        $mock      = $this->mockFileStreamer();
        $reflector = Reflector::create($mock);
        try {
            $reflector->getRequestedRanges();
            $this->fail();
        } catch (Exception $e) {
            $this->assertCount(1, Output::$headers);
            $this->assertContains('HTTP/1.1 416 Requested Range Not Satisfiable', Output::$headers);
        }
        $reflector->unset();
    }
public function testRequestedRangesInvalid ( string $ RequestedRange ) { $ _SERVER [ 'HTTP_RANGE' ] = $ RequestedRange ; $ mock = $ this -> mockFileStreamer ( ) ; $ reflector = Reflector :: create ( $ mock ) ; try { $ reflector -> getRequestedRanges ( ) ; $ this -> fail ( ) ; } catch ( Exception $ e ) { $ this -> assertCount ( 1 , Output :: $ headers ) ; $ this -> assertContains ( 'HTTP/1.1 416 Requested Range Not Satisfiable' , Output :: $ headers ) ; } $ reflector -> unset ( ) ; }
Test if the correct headers are set when requesting an invalid range.
Test if the correct headers are set when requesting an invalid range .
// Mock the class to override the terminate method. /** @var FileStreamer $mock */