diff --git a/.gitignore b/.gitignore index 4f3f707..19696cf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ composer.phar composer.lock phpunit.xml +.phpunit.result.cache sami.phar -.idea/ \ No newline at end of file +.idea/ diff --git a/.travis.yml b/.travis.yml index e368e13..3b7b963 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ php: - 7.1 - 7.2 - 7.3 + - 7.4 matrix: include: @@ -37,4 +38,4 @@ install: - composer update --prefer-dist $COMPOSER_FLAGS script: - - vendor/bin/phpunit --verbose + - vendor/bin/simple-phpunit --verbose diff --git a/composer.json b/composer.json index 3c610c2..fda1beb 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "require-dev": { "sami/sami": "~1.0", "silex/silex": "~1.0", - "phpunit/phpunit": "^4.8.36" + "symfony/phpunit-bridge": "^5.0.4" }, "autoload": { "psr-0": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3027d1f..8b9403d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,10 +7,13 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="true" verbose="false" bootstrap="tests/bootstrap.php" > + + + + tests/Unit @@ -21,10 +24,9 @@ - - vendor - tests - + + src/ + diff --git a/tests/Functional/FFProbeTest.php b/tests/Functional/FFProbeTest.php index b183e08..160793f 100644 --- a/tests/Functional/FFProbeTest.php +++ b/tests/Functional/FFProbeTest.php @@ -25,11 +25,10 @@ class FFProbeTest extends FunctionalTestCase $this->assertFalse($ffprobe->isValid(__DIR__ . '/../files/WrongFile.mp4')); } - /** - * @expectedException FFMpeg\Exception\RuntimeException - */ public function testProbeOnNonExistantFile() { + $this->expectException('\FFMpeg\Exception\RuntimeException'); + $ffprobe = FFProbe::create(); $ffprobe->streams('/path/to/no/file'); } diff --git a/tests/Unit/Filters/Audio/AudioClipTest.php b/tests/Unit/Filters/Audio/AudioClipTest.php index 8087f76..1450e52 100644 --- a/tests/Unit/Filters/Audio/AudioClipTest.php +++ b/tests/Unit/Filters/Audio/AudioClipTest.php @@ -18,7 +18,7 @@ class AudioClipTest extends TestCase { ->will($this->returnCallback(function ($filter) use (&$capturedFilter) { $capturedFilter = $filter; })); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filters = new AudioFilters($audio); @@ -36,7 +36,7 @@ class AudioClipTest extends TestCase { ->will($this->returnCallback(function ($filter) use (&$capturedFilter) { $capturedFilter = $filter; })); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filters = new AudioFilters($audio); @@ -44,4 +44,4 @@ class AudioClipTest extends TestCase { $this->assertEquals(array(0 => '-ss', 1 => '00:00:05.00', 2 => '-t', 3 => '00:00:05.00', 4 => '-acodec', 5 => 'copy'), $capturedFilter->apply($audio, $format)); } -} \ No newline at end of file +} diff --git a/tests/Unit/Filters/Audio/AudioMetadataTest.php b/tests/Unit/Filters/Audio/AudioMetadataTest.php index bc1bc13..dc20879 100644 --- a/tests/Unit/Filters/Audio/AudioMetadataTest.php +++ b/tests/Unit/Filters/Audio/AudioMetadataTest.php @@ -18,7 +18,7 @@ class AudioMetadataTest extends TestCase ->will($this->returnCallback(function ($filter) use (&$capturedFilter) { $capturedFilter = $filter; })); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filters = new AudioFilters($audio); $filters->addMetadata(array('title' => "Hello World")); @@ -36,7 +36,7 @@ class AudioMetadataTest extends TestCase ->will($this->returnCallback(function ($filter) use (&$capturedFilter) { $capturedFilter = $filter; })); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filters = new AudioFilters($audio); $filters->addMetadata(array('genre' => 'Some Genre', 'artwork' => "/path/to/file.jpg")); @@ -55,7 +55,7 @@ class AudioMetadataTest extends TestCase ->will($this->returnCallback(function ($filter) use (&$capturedFilter) { $capturedFilter = $filter; })); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filters = new AudioFilters($audio); $filters->addMetadata(); diff --git a/tests/Unit/Filters/Audio/AudioResamplableFilterTest.php b/tests/Unit/Filters/Audio/AudioResamplableFilterTest.php index 1d24393..ffdc3ea 100644 --- a/tests/Unit/Filters/Audio/AudioResamplableFilterTest.php +++ b/tests/Unit/Filters/Audio/AudioResamplableFilterTest.php @@ -16,7 +16,7 @@ class AudioResamplableFilterTest extends TestCase public function testApply() { $audio = $this->getAudioMock(); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filter = new AudioResamplableFilter(500); $this->assertEquals(array('-ac', 2, '-ar', 500), $filter->apply($audio, $format)); diff --git a/tests/Unit/Filters/Audio/CustomFilterTest.php b/tests/Unit/Filters/Audio/CustomFilterTest.php index 9c527e2..df80f48 100644 --- a/tests/Unit/Filters/Audio/CustomFilterTest.php +++ b/tests/Unit/Filters/Audio/CustomFilterTest.php @@ -12,7 +12,7 @@ class CustomFilterTest extends TestCase public function testApplyCustomFilter() { $audio = $this->getAudioMock(); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); $filter = new CustomFilter('whatever i put would end up as a filter'); $this->assertEquals(array('-af', 'whatever i put would end up as a filter'), $filter->apply($audio, $format)); diff --git a/tests/Unit/Filters/FiltersCollectionTest.php b/tests/Unit/Filters/FiltersCollectionTest.php index e10f946..55c09eb 100644 --- a/tests/Unit/Filters/FiltersCollectionTest.php +++ b/tests/Unit/Filters/FiltersCollectionTest.php @@ -13,18 +13,18 @@ class FiltersCollectionTest extends TestCase $coll = new FiltersCollection(); $this->assertCount(0, $coll); - $coll->add($this->getMock('FFMpeg\Filters\FilterInterface')); + $coll->add($this->getMockBuilder('FFMpeg\Filters\FilterInterface')->getMock()); $this->assertCount(1, $coll); - $coll->add($this->getMock('FFMpeg\Filters\FilterInterface')); + $coll->add($this->getMockBuilder('FFMpeg\Filters\FilterInterface')->getMock()); $this->assertCount(2, $coll); } public function testIterator() { $coll = new FiltersCollection(); - $coll->add($this->getMock('FFMpeg\Filters\FilterInterface')); - $coll->add($this->getMock('FFMpeg\Filters\FilterInterface')); + $coll->add($this->getMockBuilder('FFMpeg\Filters\FilterInterface')->getMock()); + $coll->add($this->getMockBuilder('FFMpeg\Filters\FilterInterface')->getMock()); $this->assertInstanceOf('\ArrayIterator', $coll->getIterator()); $this->assertCount(2, $coll->getIterator()); @@ -51,7 +51,7 @@ class FiltersCollectionTest extends TestCase $data = array(); $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\AudioInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\AudioInterface')->getMock(); foreach ($coll as $filter) { $data = array_merge($data, $filter->apply($video, $format)); diff --git a/tests/Unit/Filters/Video/CropFilterTest.php b/tests/Unit/Filters/Video/CropFilterTest.php index b865c0d..54afadb 100644 --- a/tests/Unit/Filters/Video/CropFilterTest.php +++ b/tests/Unit/Filters/Video/CropFilterTest.php @@ -22,7 +22,7 @@ class CropFilterTest extends TestCase ->method('getStreams') ->will($this->returnValue($streams)); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $dimension = new Dimension(200, 150); $point = new Point(25, 35); diff --git a/tests/Unit/Filters/Video/CustomFilterTest.php b/tests/Unit/Filters/Video/CustomFilterTest.php index f3cc047..403c29d 100644 --- a/tests/Unit/Filters/Video/CustomFilterTest.php +++ b/tests/Unit/Filters/Video/CustomFilterTest.php @@ -12,7 +12,7 @@ class CustomFilterTest extends TestCase public function testApplyCustomFilter() { $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $filter = new CustomFilter('whatever i put would end up as a filter'); $this->assertEquals(array('-vf', 'whatever i put would end up as a filter'), $filter->apply($video, $format)); diff --git a/tests/Unit/Filters/Video/ExtractMultipleFramesFilterTest.php b/tests/Unit/Filters/Video/ExtractMultipleFramesFilterTest.php index f121691..eeb14b6 100644 --- a/tests/Unit/Filters/Video/ExtractMultipleFramesFilterTest.php +++ b/tests/Unit/Filters/Video/ExtractMultipleFramesFilterTest.php @@ -17,7 +17,7 @@ class ExtractMultipleFramesFilterTest extends TestCase $video = $this->getVideoMock(); $pathfile = '/path/to/file'.mt_rand(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $format->expects($this->any()) ->method('getModulus') ->will($this->returnValue($modulus)); diff --git a/tests/Unit/Filters/Video/FrameRateFilterTest.php b/tests/Unit/Filters/Video/FrameRateFilterTest.php index b25b88f..8e3693b 100644 --- a/tests/Unit/Filters/Video/FrameRateFilterTest.php +++ b/tests/Unit/Filters/Video/FrameRateFilterTest.php @@ -14,7 +14,7 @@ class FrameRateFilterTest extends TestCase $gop = 42; $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $format->expects($this->any()) ->method('supportBFrames') ->will($this->returnValue(true)); @@ -31,7 +31,7 @@ class FrameRateFilterTest extends TestCase $gop = 42; $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $format->expects($this->any()) ->method('supportBFrames') ->will($this->returnValue(false)); diff --git a/tests/Unit/Filters/Video/PadFilterTest.php b/tests/Unit/Filters/Video/PadFilterTest.php index 1d7c85a..04b9ae5 100644 --- a/tests/Unit/Filters/Video/PadFilterTest.php +++ b/tests/Unit/Filters/Video/PadFilterTest.php @@ -18,7 +18,7 @@ class PadFilterTest extends TestCase $video = $this->getVideoMock(); $pathfile = '/path/to/file'.mt_rand(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $streams = new StreamCollection(array( new Stream(array( diff --git a/tests/Unit/Filters/Video/ResizeFilterTest.php b/tests/Unit/Filters/Video/ResizeFilterTest.php index c87a3cb..82eebf8 100644 --- a/tests/Unit/Filters/Video/ResizeFilterTest.php +++ b/tests/Unit/Filters/Video/ResizeFilterTest.php @@ -18,7 +18,7 @@ class ResizeFilterTest extends TestCase $video = $this->getVideoMock(); $pathfile = '/path/to/file'.mt_rand(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $format->expects($this->any()) ->method('getModulus') ->will($this->returnValue($modulus)); diff --git a/tests/Unit/Filters/Video/RotateFilterTest.php b/tests/Unit/Filters/Video/RotateFilterTest.php index c8aeeb2..5d90433 100644 --- a/tests/Unit/Filters/Video/RotateFilterTest.php +++ b/tests/Unit/Filters/Video/RotateFilterTest.php @@ -22,7 +22,7 @@ class RotateFilterTest extends TestCase ->method('getStreams') ->will($this->returnValue($streams)); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $filter = new RotateFilter($value); $this->assertEquals(array('-vf', $value, '-metadata:s:v:0', 'rotate=0'), $filter->apply($video, $format)); @@ -48,7 +48,7 @@ class RotateFilterTest extends TestCase $video->expects($this->never()) ->method('getStreams'); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $filter = new RotateFilter($value); $this->assertEquals(array('-vf', $value, '-metadata:s:v:0', 'rotate=0'), $filter->apply($video, $format)); diff --git a/tests/Unit/Filters/Video/SynchronizeFilterTest.php b/tests/Unit/Filters/Video/SynchronizeFilterTest.php index 85b2562..7986d76 100644 --- a/tests/Unit/Filters/Video/SynchronizeFilterTest.php +++ b/tests/Unit/Filters/Video/SynchronizeFilterTest.php @@ -10,7 +10,7 @@ class SynchronizeFilterTest extends TestCase public function testApply() { $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $filter = new SynchronizeFilter(); $this->assertEquals(array('-async', '1', '-metadata:s:v:0', 'start_time=0'), $filter->apply($video, $format)); diff --git a/tests/Unit/Filters/Video/WatermarkFilterTest.php b/tests/Unit/Filters/Video/WatermarkFilterTest.php index 4f00095..8fd43a8 100644 --- a/tests/Unit/Filters/Video/WatermarkFilterTest.php +++ b/tests/Unit/Filters/Video/WatermarkFilterTest.php @@ -17,7 +17,7 @@ class WatermarkFilterTest extends TestCase $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png'); $this->assertEquals(array('-vf', 'movie='.__DIR__ .'/../../../files/watermark.png [watermark]; [in][watermark] overlay=0:0 [out]'), $filter->apply($video, $format)); @@ -30,7 +30,7 @@ class WatermarkFilterTest extends TestCase public function testDifferentCoordinaates() { $video = $this->getVideoMock(); - $format = $this->getMock('FFMpeg\Format\VideoInterface'); + $format = $this->getMockBuilder('FFMpeg\Format\VideoInterface')->getMock(); // test position absolute $filter = new WatermarkFilter(__DIR__ . '/../../../files/watermark.png', array( diff --git a/tests/Unit/Format/Audio/AudioTestCase.php b/tests/Unit/Format/Audio/AudioTestCase.php index 16c0022..8cc9574 100644 --- a/tests/Unit/Format/Audio/AudioTestCase.php +++ b/tests/Unit/Format/Audio/AudioTestCase.php @@ -101,7 +101,7 @@ abstract class AudioTestCase extends TestCase public function testCreateProgressListener() { - $media = $this->getMock('FFMpeg\Media\MediaTypeInterface'); + $media = $this->getMockBuilder('FFMpeg\Media\MediaTypeInterface')->getMock(); $media->expects($this->any()) ->method('getPathfile') ->will($this->returnValue(__FILE__)); diff --git a/tests/Unit/Format/Video/VideoTestCase.php b/tests/Unit/Format/Video/VideoTestCase.php index a62c99f..5e09344 100644 --- a/tests/Unit/Format/Video/VideoTestCase.php +++ b/tests/Unit/Format/Video/VideoTestCase.php @@ -54,7 +54,7 @@ abstract class VideoTestCase extends AudioTestCase public function testCreateProgressListener() { - $media = $this->getMock('FFMpeg\Media\MediaTypeInterface'); + $media = $this->getMockBuilder('FFMpeg\Media\MediaTypeInterface')->getMock(); $media->expects($this->any()) ->method('getPathfile') ->will($this->returnValue(__FILE__)); diff --git a/tests/Unit/Media/AudioTest.php b/tests/Unit/Media/AudioTest.php index 5120496..873598c 100644 --- a/tests/Unit/Media/AudioTest.php +++ b/tests/Unit/Media/AudioTest.php @@ -29,7 +29,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,7 +50,7 @@ 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'); @@ -65,7 +65,7 @@ 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())); @@ -91,12 +91,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 +104,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 +138,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 +180,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 +191,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 +205,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 +216,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 +290,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 +317,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'))); diff --git a/tests/Unit/Media/ClipTest.php b/tests/Unit/Media/ClipTest.php index 61e988c..ab1b656 100644 --- a/tests/Unit/Media/ClipTest.php +++ b/tests/Unit/Media/ClipTest.php @@ -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)); diff --git a/tests/Unit/Media/ConcatTest.php b/tests/Unit/Media/ConcatTest.php index d345961..28de35e 100644 --- a/tests/Unit/Media/ConcatTest.php +++ b/tests/Unit/Media/ConcatTest.php @@ -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]' ), ), diff --git a/tests/Unit/Media/FrameTest.php b/tests/Unit/Media/FrameTest.php index 4c96527..88c0bef 100644 --- a/tests/Unit/Media/FrameTest.php +++ b/tests/Unit/Media/FrameTest.php @@ -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( diff --git a/tests/Unit/Media/GifTest.php b/tests/Unit/Media/GifTest.php index 4925953..a2dfe91 100644 --- a/tests/Unit/Media/GifTest.php +++ b/tests/Unit/Media/GifTest.php @@ -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') diff --git a/tests/Unit/Media/VideoTest.php b/tests/Unit/Media/VideoTest.php index 009a2f6..0347a4f 100644 --- a/tests/Unit/Media/VideoTest.php +++ b/tests/Unit/Media/VideoTest.php @@ -29,7 +29,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 +50,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 +79,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,7 +87,7 @@ 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') @@ -108,7 +108,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 +116,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 +124,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 +158,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 +233,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 +253,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 +273,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 +290,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 +316,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 +342,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 +362,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 +382,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 +585,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 +612,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'))); diff --git a/tests/Unit/Media/WaveformTest.php b/tests/Unit/Media/WaveformTest.php index 5d13c2e..4151235 100644 --- a/tests/Unit/Media/WaveformTest.php +++ b/tests/Unit/Media/WaveformTest.php @@ -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') diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 2d366dd..f7670bf 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -13,12 +13,12 @@ class TestCase extends BaseTestCase public function getLoggerMock() { - return $this->getMock('Psr\Log\LoggerInterface'); + return $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); } public function getCacheMock() { - return $this->getMock('Doctrine\Common\Cache\Cache'); + return $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock(); } public function getTimeCodeMock() @@ -86,17 +86,17 @@ class TestCase extends BaseTestCase public function getFFProbeParserMock() { - return $this->getMock('FFMpeg\FFProbe\OutputParserInterface'); + return $this->getMockBuilder('FFMpeg\FFProbe\OutputParserInterface')->getMock(); } public function getFFProbeOptionsTesterMock() { - return $this->getMock('FFMpeg\FFProbe\OptionsTesterInterface'); + return $this->getMockBuilder('FFMpeg\FFProbe\OptionsTesterInterface')->getMock(); } public function getFFProbeMapperMock() { - return $this->getMock('FFMpeg\FFProbe\MapperInterface'); + return $this->getMockBuilder('FFMpeg\FFProbe\MapperInterface')->getMock(); } public function getFFProbeOptionsTesterMockWithOptions(array $options) @@ -114,7 +114,7 @@ class TestCase extends BaseTestCase public function getConfigurationMock() { - return $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface'); + return $this->getMockBuilder('Alchemy\BinaryDriver\ConfigurationInterface')->getMock(); } public function getFormatMock()