Add bc layer for older php and phpunit versions

This commit is contained in:
Alexander Schranz 2020-02-19 21:52:13 +01:00
commit 7474bf936f
16 changed files with 90 additions and 99 deletions

View file

@ -42,12 +42,12 @@ class StreamTest extends TestCase
);
}
/**
* @expectedExceptionMessage Dimensions can only be retrieved from video streams.
*/
public function testGetDimensionsFromAudio()
{
$this->expectException('\FFMpeg\Exception\LogicException');
$this->expectException(
'\FFMpeg\Exception\LogicException',
'Dimensions can only be retrieved from video streams.'
);
$stream = new Stream(array('codec_type' => 'audio'));
$stream->getDimensions();
}
@ -60,11 +60,13 @@ class StreamTest extends TestCase
/**
* @dataProvider provideInvalidPropertiesForDimensionsExtraction
* @expectedExceptionMessage Unable to extract dimensions.
*/
public function testUnableToGetDimensionsFromVideo($properties)
{
$this->expectException('\FFMpeg\Exception\RuntimeException');
$this->expectException(
'\FFMpeg\Exception\RuntimeException',
'Unable to extract dimensions.'
);
$stream = new Stream(array('codec_type' => 'video', 'width' => 960));
$stream->getDimensions();
}

View file

@ -20,8 +20,6 @@ class MapperTest extends TestCase
$this->assertEquals($expected, $mapper->map($type, $data));
}
/**
*/
public function testMapInvalidArgument()
{
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');

View file

@ -2,26 +2,28 @@
namespace Tests\FFMpeg\Unit\FFProbe;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use FFMpeg\Exception\RuntimeException;
use Tests\FFMpeg\Unit\TestCase;
use FFMpeg\FFProbe\OptionsTester;
class OptionsTesterTest extends TestCase
{
/**
* @expectedExceptionMessage Your FFProbe version is too old and does not support `-help` option, please upgrade.
*/
public function testHasOptionWithOldFFProbe()
{
$this->expectException('\FFMpeg\Exception\RuntimeException');
$this->expectException(
'\FFMpeg\Exception\RuntimeException',
'Your FFProbe version is too old and does not support `-help` option, please upgrade.'
);
$cache = $this->getCacheMock();
$executionFailerExceptionMock = $this->getMockBuilder('Alchemy\BinaryDriver\Exception\ExecutionFailureException')
->disableOriginalConstructor()
->getMock();
$ffprobe = $this->getFFProbeDriverMock();
$ffprobe->expects($this->once())
->method('command')
->with(array('-help', '-loglevel', 'quiet'))
->will($this->throwException(new RuntimeException('Failed to execute')));
->will($this->throwException($executionFailerExceptionMock));
$tester = new OptionsTester($ffprobe, $cache);
$tester->has('-print_format');

View file

@ -17,8 +17,6 @@ class OutputParserTest extends TestCase
$this->assertEquals($expectedOutput, $parser->parse($type, $data));
}
/**
*/
public function testParseWithInvalidArgument()
{
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');