Fix PhpUnit tests for newer php version

This commit is contained in:
Alexander Schranz 2020-02-13 00:39:31 +01:00
commit 14dc6a8b1b
21 changed files with 48 additions and 40 deletions

View file

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

View file

@ -21,10 +21,10 @@ class MapperTest extends TestCase
}
/**
* @expectedException FFMpeg\Exception\InvalidArgumentException
*/
public function testMapInvalidArgument()
{
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
$mapper = new Mapper();
$mapper->map('cool type', 'data');
}

View file

@ -3,24 +3,25 @@
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
{
/**
* @expectedException FFMpeg\Exception\RuntimeException
* @expectedExceptionMessage Your FFProbe version is too old and does not support `-help` option, please upgrade.
*/
public function testHasOptionWithOldFFProbe()
{
$this->expectException('\FFMpeg\Exception\RuntimeException');
$cache = $this->getCacheMock();
$ffprobe = $this->getFFProbeDriverMock();
$ffprobe->expects($this->once())
->method('command')
->with(array('-help', '-loglevel', 'quiet'))
->will($this->throwException(new ExecutionFailureException('Failed to execute')));
->will($this->throwException(new RuntimeException('Failed to execute')));
$tester = new OptionsTester($ffprobe, $cache);
$tester->has('-print_format');

View file

@ -18,10 +18,10 @@ class OutputParserTest extends TestCase
}
/**
* @expectedException FFMpeg\Exception\InvalidArgumentException
*/
public function testParseWithInvalidArgument()
{
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
$parser = new OutputParser();
$parser->parse('comme ca', 'data');
}