scratch – Blame information for rev
?pathlinks?
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\OutputParser; |
||
7 | use FFMpeg\FFProbe; |
||
8 | |||
9 | class OutputParserTest extends TestCase |
||
10 | { |
||
11 | /** |
||
12 | * @dataProvider provideTypeDataAndOutput |
||
13 | */ |
||
14 | public function testParse($type, $data, $expectedOutput) |
||
15 | { |
||
16 | $parser = new OutputParser(); |
||
17 | $this->assertEquals($expectedOutput, $parser->parse($type, $data)); |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * @expectedException FFMpeg\Exception\InvalidArgumentException |
||
22 | */ |
||
23 | public function testParseWithInvalidArgument() |
||
24 | { |
||
25 | $parser = new OutputParser(); |
||
26 | $parser->parse('comme ca', 'data'); |
||
27 | } |
||
28 | |||
29 | public function provideTypeDataAndOutput() |
||
30 | { |
||
31 | $expectedFormat = json_decode(file_get_contents(__DIR__ . '/../../fixtures/ffprobe/show_format.json'), true); |
||
32 | $expectedStreams = json_decode(file_get_contents(__DIR__ . '/../../fixtures/ffprobe/show_streams.json'), true); |
||
33 | |||
34 | $rawFormat = file_get_contents(__DIR__ . '/../../fixtures/ffprobe/show_format.raw'); |
||
35 | $rawStreams = file_get_contents(__DIR__ . '/../../fixtures/ffprobe/show_streams.raw'); |
||
36 | |||
37 | return array( |
||
38 | array(FFProbe::TYPE_FORMAT, $rawFormat, $expectedFormat), |
||
39 | array(FFProbe::TYPE_STREAMS, $rawStreams, $expectedStreams), |
||
40 | ); |
||
41 | } |
||
42 | } |