scratch – Blame information for rev

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <?php
2  
3 namespace Tests\FFMpeg\Unit\FFProbe;
4  
5 use Tests\FFMpeg\Unit\TestCase;
6 use FFMpeg\FFProbe\Mapper;
7 use FFMpeg\FFProbe;
8 use FFMpeg\FFProbe\DataMapping\Format;
9 use FFMpeg\FFProbe\DataMapping\Stream;
10 use FFMpeg\FFProbe\DataMapping\StreamCollection;
11  
12 class MapperTest extends TestCase
13 {
14 /**
15 * @dataProvider provideMappings
16 */
17 public function testMap($type, $data, $expected)
18 {
19 $mapper = new Mapper();
20 $this->assertEquals($expected, $mapper->map($type, $data));
21 }
22  
23 /**
24 * @expectedException FFMpeg\Exception\InvalidArgumentException
25 */
26 public function testMapInvalidArgument()
27 {
28 $mapper = new Mapper();
29 $mapper->map('cool type', 'data');
30 }
31  
32 public function provideMappings()
33 {
34 $format = json_decode(file_get_contents(__DIR__ . '/../../fixtures/ffprobe/show_format.json'), true);
35 $streams = json_decode(file_get_contents(__DIR__ . '/../../fixtures/ffprobe/show_streams.json'), true);
36  
37 return array(
38 array(FFProbe::TYPE_FORMAT, $format, new Format($format['format'])),
39 array(FFProbe::TYPE_STREAMS, $streams, new StreamCollection(array_map(function ($streamData) {
40 return new Stream($streamData);
41 }, $streams['streams']))),
42 );
43 }
44 }