Version 0.3
This commit is contained in:
parent
0d69145ec3
commit
ad3a5af623
130 changed files with 7283 additions and 2627 deletions
44
tests/FFMpeg/Tests/FFProbe/MapperTest.php
Normal file
44
tests/FFMpeg/Tests/FFProbe/MapperTest.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace FFMpeg\Tests\FFProbe;
|
||||
|
||||
use FFMpeg\Tests\TestCase;
|
||||
use FFMpeg\FFProbe\Mapper;
|
||||
use FFMpeg\FFProbe;
|
||||
use FFMpeg\FFProbe\DataMapping\Format;
|
||||
use FFMpeg\FFProbe\DataMapping\Stream;
|
||||
use FFMpeg\FFProbe\DataMapping\StreamCollection;
|
||||
|
||||
class MapperTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideMappings
|
||||
*/
|
||||
public function testMap($type, $data, $expected)
|
||||
{
|
||||
$mapper = new Mapper();
|
||||
$this->assertEquals($expected, $mapper->map($type, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException FFMpeg\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testMapInvalidArgument()
|
||||
{
|
||||
$mapper = new Mapper();
|
||||
$mapper->map('cool type', 'data');
|
||||
}
|
||||
|
||||
public function provideMappings()
|
||||
{
|
||||
$format = json_decode(file_get_contents(__DIR__ . '/../../../fixtures/ffprobe/show_format.json'), true);
|
||||
$streams = json_decode(file_get_contents(__DIR__ . '/../../../fixtures/ffprobe/show_streams.json'), true);
|
||||
|
||||
return array(
|
||||
array(FFProbe::TYPE_FORMAT, $format, new Format($format['format'])),
|
||||
array(FFProbe::TYPE_STREAMS, $streams, new StreamCollection(array_map(function ($streamData) {
|
||||
return new Stream($streamData);
|
||||
}, $streams['streams']))),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue