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

@ -3,13 +3,14 @@
namespace Tests\FFMpeg\Unit\Media;
use FFMpeg\Media\Concat;
use Mockery;
use Spatie\TemporaryDirectory\TemporaryDirectory;
class ConcatTest extends AbstractMediaTestCase
{
public function testGetSources()
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$concat = new Concat([__FILE__, __FILE__], $driver, $ffprobe);
@ -18,7 +19,7 @@ class ConcatTest extends AbstractMediaTestCase
public function testFiltersReturnFilters()
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$concat = new Concat([__FILE__, __FILE__], $driver, $ffprobe);
@ -27,7 +28,7 @@ class ConcatTest extends AbstractMediaTestCase
public function testAddFiltersAddsAFilter()
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$filters = $this->getMockBuilder('FFMpeg\Filters\FiltersCollection')
@ -50,13 +51,24 @@ class ConcatTest extends AbstractMediaTestCase
*/
public function testSaveFromSameCodecs($streamCopy, $commands)
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$pathfile = '/target/destination';
array_push($commands, $pathfile);
$configuration = Mockery::mock('Alchemy\BinaryDriver\ConfigurationInterface');
$driver->expects($this->any())
->method('getConfiguration')
->will($this->returnValue($configuration));
$configuration->shouldReceive('get')
->once()
->with('temporary_directory')
->andReturnNull();
$driver->expects($this->exactly(1))
->method('command')
->with($this->isType('array'), false, $this->anything())
@ -79,7 +91,7 @@ class ConcatTest extends AbstractMediaTestCase
public function provideSaveFromSameCodecsOptions()
{
$fs = (new TemporaryDirectory())->create();
$fs = (new TemporaryDirectory())->create();
$tmpFile = $fs->path('ffmpeg-concat');
touch($tmpFile);
@ -109,9 +121,9 @@ class ConcatTest extends AbstractMediaTestCase
*/
public function testSaveFromDifferentCodecs($commands)
{
$driver = $this->getFFMpegDriverMock();
$driver = $this->getFFMpegDriverMock();
$ffprobe = $this->getFFProbeMock();
$format = $this->getFormatInterfaceMock();
$format = $this->getFormatInterfaceMock();
$pathfile = '/target/destination';