Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
580fb21d5a
45 changed files with 240 additions and 185 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\FFMpeg\Unit\Media;
|
||||
|
||||
use FFMpeg\Exception\RuntimeException;
|
||||
use FFMpeg\Media\Audio;
|
||||
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
|
||||
use FFMpeg\Format\AudioInterface;
|
||||
|
|
@ -29,7 +30,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
$audio = new Audio(__FILE__, $driver, $ffprobe);
|
||||
$audio->setFiltersCollection($filters);
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Audio\AudioFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Audio\AudioFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
@ -50,12 +51,12 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
$audio = new Audio(__FILE__, $driver, $ffprobe);
|
||||
$audio->setFiltersCollection($filters);
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Video\VideoFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Video\VideoFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->never())
|
||||
->method('add');
|
||||
|
||||
$this->setExpectedException('FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$audio->addFilter($filter);
|
||||
}
|
||||
|
||||
|
|
@ -65,24 +66,24 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
$ffprobe = $this->getFFProbeMock();
|
||||
$outputPathfile = '/target/file';
|
||||
|
||||
$format = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
->will($this->returnValue($configuration));
|
||||
|
||||
$failure = new ExecutionFailureException('failed to encode');
|
||||
$failure = new RuntimeException('failed to encode');
|
||||
$driver->expects($this->once())
|
||||
->method('command')
|
||||
->will($this->throwException($failure));
|
||||
|
||||
$audio = new Audio(__FILE__, $driver, $ffprobe);
|
||||
$this->setExpectedException('FFMpeg\Exception\RuntimeException');
|
||||
$this->expectException('\FFMpeg\Exception\RuntimeException');
|
||||
$audio->save($format, $outputPathfile);
|
||||
}
|
||||
|
||||
|
|
@ -91,12 +92,12 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
$outputPathfile = '/target/file';
|
||||
$format = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -104,7 +105,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
|
||||
$audio = new Audio(__FILE__, $driver, $ffprobe);
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Audio\AudioFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Audio\AudioFilterInterface')->getMock();
|
||||
$filter->expects($this->once())
|
||||
->method('apply')
|
||||
->with($audio, $format)
|
||||
|
|
@ -138,7 +139,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -180,7 +181,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
|
||||
public function provideSaveData()
|
||||
{
|
||||
$format = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -191,7 +192,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
->method('getAudioChannels')
|
||||
->will($this->returnValue(5));
|
||||
|
||||
$audioFormat = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$audioFormat = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$audioFormat->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -205,7 +206,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
->method('getAudioCodec')
|
||||
->will($this->returnValue('patati-patata-audio'));
|
||||
|
||||
$formatExtra = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$formatExtra = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$formatExtra->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array('extra', 'param')));
|
||||
|
|
@ -216,7 +217,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
->method('getAudioChannels')
|
||||
->will($this->returnValue(5));
|
||||
|
||||
$listeners = array($this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface'));
|
||||
$listeners = array($this->getMockBuilder('Alchemy\BinaryDriver\Listeners\ListenerInterface')->getMock());
|
||||
|
||||
$progressableFormat = $this->getMockBuilder('Tests\FFMpeg\Unit\Media\AudioProg')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
|
@ -290,7 +291,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -317,7 +318,7 @@ class AudioTest extends AbstractStreamableTestCase
|
|||
|
||||
$outputPathfile = '/target/file';
|
||||
|
||||
$format = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array('param')));
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ClipTest extends AbstractMediaTestCase
|
|||
|
||||
$outputPathfile = '/target/file';
|
||||
|
||||
$format = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getPasses')
|
||||
->will($this->returnValue(1));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class ConcatTest extends AbstractMediaTestCase
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Concat\ConcatFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Concat\ConcatFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
@ -115,7 +115,7 @@ class ConcatTest extends AbstractMediaTestCase
|
|||
|
||||
array_push($commands, $pathfile);
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -136,9 +136,9 @@ class ConcatTest extends AbstractMediaTestCase
|
|||
array(
|
||||
'-i', __FILE__,
|
||||
'-i', 'concat-2.mp4',
|
||||
'-filter_complex',
|
||||
'-filter_complex',
|
||||
'[0:v:0] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [v] [a]',
|
||||
'-map', '[v]',
|
||||
'-map', '[v]',
|
||||
'-map', '[a]'
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class FrameTest extends AbstractMediaTestCase
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Frame\FrameFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Frame\FrameFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
@ -78,7 +78,7 @@ class FrameTest extends AbstractMediaTestCase
|
|||
$frame->save($pathfile, $accurate, $base64);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function provideSaveOptions()
|
||||
{
|
||||
return array(
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class GifTest extends AbstractMediaTestCase
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Gif\GifFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Gif\GifFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\FFMpeg\Unit\Media;
|
||||
|
||||
use FFMpeg\Exception\RuntimeException;
|
||||
use FFMpeg\Media\Video;
|
||||
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
|
||||
use FFMpeg\Format\VideoInterface;
|
||||
|
|
@ -29,7 +30,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
$video = new Video(__FILE__, $driver, $ffprobe);
|
||||
$video->setFiltersCollection($filters);
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Video\VideoFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Video\VideoFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
@ -50,7 +51,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
$video = new Video(__FILE__, $driver, $ffprobe);
|
||||
$video->setFiltersCollection($filters);
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Audio\AudioFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Audio\AudioFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
@ -79,7 +80,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
$outputPathfile = '/target/file';
|
||||
$format = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getPasses')
|
||||
->will($this->returnValue(1));
|
||||
|
|
@ -87,19 +88,19 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
->will($this->returnValue($configuration));
|
||||
|
||||
$failure = new ExecutionFailureException('failed to encode');
|
||||
$failure = new RuntimeException('failed to encode');
|
||||
$driver->expects($this->once())
|
||||
->method('command')
|
||||
->will($this->throwException($failure));
|
||||
|
||||
$video = new Video(__FILE__, $driver, $ffprobe);
|
||||
$this->setExpectedException('FFMpeg\Exception\RuntimeException');
|
||||
$this->expectException('\FFMpeg\Exception\RuntimeException');
|
||||
$video->save($format, $outputPathfile);
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
$outputPathfile = '/target/file';
|
||||
$format = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -116,7 +117,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getPasses')
|
||||
->will($this->returnValue(2));
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -124,7 +125,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
|
||||
$video = new Video(__FILE__, $driver, $ffprobe);
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Video\VideoFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Video\VideoFilterInterface')->getMock();
|
||||
$filter->expects($this->once())
|
||||
->method('apply')
|
||||
->with($video, $format)
|
||||
|
|
@ -158,7 +159,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -233,7 +234,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
|
||||
public function provideSaveData()
|
||||
{
|
||||
$format = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -253,7 +254,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getAdditionalParameters')
|
||||
->will($this->returnValue(array('foo', 'bar')));
|
||||
|
||||
$format2 = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$format2 = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$format2->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -273,7 +274,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getAdditionalParameters')
|
||||
->will($this->returnValue(array('foo', 'bar')));
|
||||
|
||||
$audioFormat = $this->getMock('FFMpeg\Format\AudioInterface');
|
||||
$audioFormat = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock();
|
||||
$audioFormat->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -290,7 +291,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getPasses')
|
||||
->will($this->returnValue(1));
|
||||
|
||||
$audioVideoFormat = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$audioVideoFormat = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$audioVideoFormat->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -316,7 +317,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getAdditionalParameters')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$audioVideoFormatSinglePass = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$audioVideoFormatSinglePass = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$audioVideoFormatSinglePass->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array()));
|
||||
|
|
@ -342,7 +343,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getAdditionalParameters')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$formatExtra = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$formatExtra = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$formatExtra->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array('extra', 'param')));
|
||||
|
|
@ -362,7 +363,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getAdditionalParameters')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$formatExtra2 = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$formatExtra2 = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$formatExtra2->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array('extra', 'param')));
|
||||
|
|
@ -382,7 +383,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
->method('getAdditionalParameters')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$listeners = array($this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface'));
|
||||
$listeners = array($this->getMockBuilder('Alchemy\BinaryDriver\Listeners\ListenerInterface')->getMock());
|
||||
|
||||
$progressableFormat = $this->getMockBuilder('Tests\FFMpeg\Unit\Media\Prog')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
|
@ -585,7 +586,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
$driver = $this->getFFMpegDriverMock();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
|
||||
$configuration = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
|
||||
$configuration = $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock();
|
||||
|
||||
$driver->expects($this->any())
|
||||
->method('getConfiguration')
|
||||
|
|
@ -612,7 +613,7 @@ class VideoTest extends AbstractStreamableTestCase
|
|||
|
||||
$outputPathfile = '/target/file';
|
||||
|
||||
$format = $this->getMock('FFMpeg\Format\VideoInterface');
|
||||
$format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock();
|
||||
$format->expects($this->any())
|
||||
->method('getExtraParams')
|
||||
->will($this->returnValue(array('param')));
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class WaveformTest extends AbstractMediaTestCase
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$filter = $this->getMock('FFMpeg\Filters\Waveform\WaveformFilterInterface');
|
||||
$filter = $this->getMockBuilder('FFMpeg\Filters\Waveform\WaveformFilterInterface')->getMock();
|
||||
|
||||
$filters->expects($this->once())
|
||||
->method('add')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue