Specify temporary directory + fix for default ffmpeg-passes* temporary directory (#855)

This commit is contained in:
Pascal Baljet 2022-02-22 16:54:06 +01:00 committed by GitHub
commit bda300b69a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 119 additions and 35 deletions

View file

@ -8,7 +8,7 @@ class AdvancedMediaTest extends AbstractMediaTestCase
{
public function testGetInputs()
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$advancedMedia = new AdvancedMedia([__FILE__, __FILE__], $driver, $ffprobe);
@ -17,7 +17,7 @@ class AdvancedMediaTest extends AbstractMediaTestCase
public function testGetInputsCount()
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$advancedMedia = new AdvancedMedia([__FILE__, __FILE__], $driver, $ffprobe);
@ -26,10 +26,48 @@ class AdvancedMediaTest extends AbstractMediaTestCase
public function testFiltersReturnFilters()
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$advancedMedia = new AdvancedMedia([__FILE__, __FILE__], $driver, $ffprobe);
$this->assertInstanceOf('FFMpeg\Filters\AdvancedMedia\ComplexFilters', $advancedMedia->filters());
}
public function testGetTemporaryDirectoryWithoutCustomConfiguration()
{
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$configuration = $this->getConfigurationMock();
$driver->expects($this->any())
->method('getConfiguration')
->will($this->returnValue($configuration));
$configuration->expects($this->once())
->method('get')
->with($this->equalTo('temporary_directory'))
->will($this->returnValue(null));
$advancedMedia = new AdvancedMedia([__FILE__, __FILE__], $driver, $ffprobe);
$this->assertEquals('', $advancedMedia->getTemporaryDirectory()->path());
}
public function testGetTemporaryDirectoryWithCustomConfiguration()
{
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$configuration = $this->getConfigurationMock();
$driver->expects($this->any())
->method('getConfiguration')
->will($this->returnValue($configuration));
$configuration->expects($this->once())
->method('get')
->with($this->equalTo('temporary_directory'))
->will($this->returnValue('/var/ffmpeg'));
$advancedMedia = new AdvancedMedia([__FILE__, __FILE__], $driver, $ffprobe);
$this->assertEquals('/var/ffmpeg', $advancedMedia->getTemporaryDirectory()->path());
}
}