ffmpeg-mappable-media/tests/FFMpeg/Unit/Driver/FFMpegDriverTest.php

50 lines
1.4 KiB
PHP
Raw Normal View History

2013-06-25 10:03:20 +02:00
<?php
namespace Tests\FFMpeg\Unit\Driver;
2013-06-25 10:03:20 +02:00
use Alchemy\BinaryDriver\Configuration;
use FFMpeg\Driver\FFMpegDriver;
use Symfony\Component\Process\ExecutableFinder;
use Tests\FFMpeg\Unit\TestCase;
2013-06-25 10:03:20 +02:00
class FFMpegDriverTest extends TestCase
{
public function setUp(): void
2013-06-25 10:03:20 +02:00
{
$executableFinder = new ExecutableFinder();
$found = false;
foreach (['avconv', 'ffmpeg'] as $name) {
2013-06-25 10:03:20 +02:00
if (null !== $executableFinder->find($name)) {
$found = true;
break;
}
}
if (!$found) {
$this->markTestSkipped('Neither ffmpeg or avconv found');
}
}
public function testCreate()
{
$logger = $this->getLoggerMock();
$ffmpeg = FFMpegDriver::create($logger, []);
2013-06-25 10:03:20 +02:00
$this->assertInstanceOf('FFMpeg\Driver\FFMpegDriver', $ffmpeg);
$this->assertEquals($logger, $ffmpeg->getProcessRunner()->getLogger());
}
public function testCreateWithConfig()
{
$conf = new Configuration();
$ffmpeg = FFMpegDriver::create($this->getLoggerMock(), $conf);
$this->assertEquals($conf, $ffmpeg->getConfiguration());
}
2013-07-03 14:13:29 +02:00
public function testCreateFailureThrowsAnException()
{
$this->expectException('\FFMpeg\Exception\ExecutableNotFoundException');
FFMpegDriver::create($this->getLoggerMock(), ['ffmpeg.binaries' => '/path/to/nowhere']);
2013-07-03 14:13:29 +02:00
}
2013-06-25 10:03:20 +02:00
}