scratch – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
115 | office | 1 | <?php |
2 | |||
3 | namespace Tests\FFMpeg\Unit; |
||
4 | |||
5 | use FFMpeg\FFMpegServiceProvider; |
||
6 | use Silex\Application; |
||
7 | |||
8 | class FFMpegServiceProviderTest extends \PHPUnit_Framework_TestCase |
||
9 | { |
||
10 | public function testWithConfig() |
||
11 | { |
||
12 | $app = new Application(); |
||
13 | $app->register(new FFMpegServiceProvider(), array( |
||
14 | 'ffmpeg.configuration' => array( |
||
15 | 'ffmpeg.threads' => 12, |
||
16 | 'ffmpeg.timeout' => 10666, |
||
17 | 'ffprobe.timeout' => 4242, |
||
18 | ) |
||
19 | )); |
||
20 | |||
21 | $this->assertInstanceOf('FFMpeg\FFMpeg', $app['ffmpeg']); |
||
22 | $this->assertSame($app['ffmpeg'], $app['ffmpeg.ffmpeg']); |
||
23 | $this->assertInstanceOf('FFMpeg\FFProbe', $app['ffmpeg.ffprobe']); |
||
24 | |||
25 | $this->assertEquals(12, $app['ffmpeg']->getFFMpegDriver()->getConfiguration()->get('ffmpeg.threads')); |
||
26 | $this->assertEquals(10666, $app['ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getTimeout()); |
||
27 | $this->assertEquals(4242, $app['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getTimeout()); |
||
28 | } |
||
29 | |||
30 | public function testWithoutConfig() |
||
31 | { |
||
32 | $app = new Application(); |
||
33 | $app->register(new FFMpegServiceProvider()); |
||
34 | |||
35 | $this->assertInstanceOf('FFMpeg\FFMpeg', $app['ffmpeg']); |
||
36 | $this->assertSame($app['ffmpeg'], $app['ffmpeg.ffmpeg']); |
||
37 | $this->assertInstanceOf('FFMpeg\FFProbe', $app['ffmpeg.ffprobe']); |
||
38 | |||
39 | $this->assertEquals(4, $app['ffmpeg']->getFFMpegDriver()->getConfiguration()->get('ffmpeg.threads')); |
||
40 | $this->assertEquals(300, $app['ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getTimeout()); |
||
41 | $this->assertEquals(30, $app['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getTimeout()); |
||
42 | } |
||
43 | |||
44 | public function testWithFFMpegBinaryConfig() |
||
45 | { |
||
46 | $app = new Application(); |
||
47 | $app->register(new FFMpegServiceProvider(), array( |
||
48 | 'ffmpeg.configuration' => array( |
||
49 | 'ffmpeg.binaries' => '/path/to/ffmpeg', |
||
50 | ) |
||
51 | )); |
||
52 | |||
53 | $this->setExpectedException('FFMpeg\Exception\ExecutableNotFoundException', 'Unable to load FFMpeg'); |
||
54 | $app['ffmpeg']; |
||
55 | } |
||
56 | |||
57 | public function testWithFFMprobeBinaryConfig() |
||
58 | { |
||
59 | $app = new Application(); |
||
60 | $app->register(new FFMpegServiceProvider(), array( |
||
61 | 'ffmpeg.configuration' => array( |
||
62 | 'ffprobe.binaries' => '/path/to/ffprobe', |
||
63 | ) |
||
64 | )); |
||
65 | |||
66 | $this->setExpectedException('FFMpeg\Exception\ExecutableNotFoundException', 'Unable to load FFProbe'); |
||
67 | $app['ffmpeg.ffprobe']; |
||
68 | } |
||
69 | } |