Fix mocking of objects for newer phpunit version
This commit is contained in:
parent
89b0c2b4d0
commit
537f61095f
29 changed files with 87 additions and 84 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue