Cleanup phpunit configs and PSR-4 autoloading and namespaces for tests

This commit is contained in:
Patrik Karisch 2016-03-06 23:38:04 +01:00
commit f9c6316bad
59 changed files with 128 additions and 144 deletions

View file

@ -0,0 +1,51 @@
<?php
namespace Tests\FFMpeg\Unit\Driver;
use Alchemy\BinaryDriver\Configuration;
use FFMpeg\Driver\FFMpegDriver;
use Tests\FFMpeg\Unit\TestCase;
use Symfony\Component\Process\ExecutableFinder;
class FFMpegDriverTest extends TestCase
{
public function setUp()
{
$executableFinder = new ExecutableFinder();
$found = false;
foreach (array('avconv', 'ffmpeg') as $name) {
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, array());
$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());
}
/**
* @expectedException FFMpeg\Exception\ExecutableNotFoundException
*/
public function testCreateFailureThrowsAnException()
{
FFMpegDriver::create($this->getLoggerMock(), array('ffmpeg.binaries' => '/path/to/nowhere'));
}
}

View file

@ -0,0 +1,51 @@
<?php
namespace Tests\FFMpeg\Unit\Driver;
use Alchemy\BinaryDriver\Configuration;
use FFMpeg\Driver\FFProbeDriver;
use Tests\FFMpeg\Unit\TestCase;
use Symfony\Component\Process\ExecutableFinder;
class FFProbeDriverTest extends TestCase
{
public function setUp()
{
$executableFinder = new ExecutableFinder();
$found = false;
foreach (array('avprobe', 'ffprobe') as $name) {
if (null !== $executableFinder->find($name)) {
$found = true;
break;
}
}
if (!$found) {
$this->markTestSkipped('Neither ffprobe or avprobe found');
}
}
public function testCreate()
{
$logger = $this->getLoggerMock();
$ffprobe = FFProbeDriver::create(array(), $logger);
$this->assertInstanceOf('FFMpeg\Driver\FFProbeDriver', $ffprobe);
$this->assertEquals($logger, $ffprobe->getProcessRunner()->getLogger());
}
public function testCreateWithConfig()
{
$conf = new Configuration();
$ffprobe = FFProbeDriver::create($conf, $this->getLoggerMock());
$this->assertEquals($conf, $ffprobe->getConfiguration());
}
/**
* @expectedException FFMpeg\Exception\ExecutableNotFoundException
*/
public function testCreateFailureThrowsAnException()
{
FFProbeDriver::create(array('ffprobe.binaries' => '/path/to/nowhere'));
}
}