tests/FileStreamerTest.php
/**
     * Mock the FileStreamer class to override the terminate method.
     *
     * The terminate method contains an exit statement which will abort the execution of php.
     * To prevent this, this method is overridden and will only raise an exception instead.
     *
     * @return MockObject The mocked FileDownload class.
     */
Mock the FileStreamer class to override the terminate method.
The terminate method contains an exit statement which will abort the execution of php.
To prevent this, this method is overridden and will only raise an exception instead.


Mock the FileStreamer class to override the terminate method . The terminate method contains an exit statement which will abort the execution of php . To prevent this this method is overridden and will only raise an exception instead .
private function mockFileStreamer(): MockObject
    {
        $mock = $this->getMockBuilder(FileStreamer::class)
                     ->onlyMethods(['terminate'])
                     ->setConstructorArgs([vfsStream::url('source/dummyFile.txt')])
                     ->getMock();
        $mock->method('terminate')->willThrowException(new Exception('Mocked'));
        return $mock;
    }
private function mockFileStreamer ( ) : MockObject { $ mock = $ this -> getMockBuilder ( FileStreamer :: class ) -> onlyMethods ( [ 'terminate' ] ) -> setConstructorArgs ( [ vfsStream :: url ( 'source/dummyFile.txt' ) ] ) -> getMock ( ) ; $ mock -> method ( 'terminate' ) -> willThrowException ( new Exception ( 'Mocked' ) ) ; return $ mock ; }
Mock the FileStreamer class to override the terminate method.
Mock the FileStreamer class to override the terminate method .