tests/FileStreamerTest.php
/**
     * Test if the correct data is being served when no range is requested.
     *
     * @return void
     */
Test if the correct data is being served when no range is requested.
@return void
Test if the correct data is being served when no range is requested . @return void
public function testStartNoRange(): void
    {
        unset($_SERVER['HTTP_RANGE']);
        $mock = $this->mockFileStreamer();
        try {
            @$mock->start();
        } catch (Exception $e) {
            $this->assertSame(self::defaultHeaders, Output::$headers);
        }
        Output::reset();
        $mock->setInline(true);
        $expectedHeaders = array_merge(self::defaultHeaders, ['Content-Disposition: inline']);
        try {
            @$mock->start();
        } catch (Exception $e) {
            $this->assertSame($expectedHeaders, Output::$headers);
            $this->assertSame('0123456789', Output::getBody());
        }
    }
public function testStartNoRange ( ) : void { unset ( $ _SERVER [ 'HTTP_RANGE' ] ) ; $ mock = $ this -> mockFileStreamer ( ) ; try { @ $ mock -> start ( ) ; } catch ( Exception $ e ) { $ this -> assertSame ( self :: defaultHeaders , Output :: $ headers ) ; } Output :: reset ( ) ; $ mock -> setInline ( true ) ; $ expectedHeaders = array_merge ( self :: defaultHeaders , [ 'Content-Disposition: inline' ] ) ; try { @ $ mock -> start ( ) ; } catch ( Exception $ e ) { $ this -> assertSame ( $ expectedHeaders , Output :: $ headers ) ; $ this -> assertSame ( '0123456789' , Output :: getBody ( ) ) ; } }
Test if the correct data is being served when no range is requested.
Test if the correct data is being served when no range is requested .
// Get a mocked instance of the class with overridden terminate method. /** @var FileStreamer $mock */ // Attachment disposition Test. // Suppress warning or method will be aborted. // Test headers. // Inline disposition Test. // Suppress warning or method will be aborted. // Test headers.