2013-08-05 14:36:27 +02:00
|
|
|
<?php
|
|
|
|
|
|
2016-03-06 23:38:04 +01:00
|
|
|
namespace Tests\FFMpeg\Functional;
|
2013-08-05 14:36:27 +02:00
|
|
|
|
|
|
|
|
use FFMpeg\FFProbe;
|
|
|
|
|
|
|
|
|
|
class FFProbeTest extends FunctionalTestCase
|
|
|
|
|
{
|
|
|
|
|
public function testProbeOnFile()
|
|
|
|
|
{
|
|
|
|
|
$ffprobe = FFProbe::create();
|
2022-02-09 14:32:43 +01:00
|
|
|
$this->assertGreaterThan(0, count($ffprobe->streams(__DIR__.'/../files/Audio.mp3')));
|
2013-08-05 14:36:27 +02:00
|
|
|
}
|
|
|
|
|
|
2017-09-19 19:28:34 +02:00
|
|
|
public function testValidateExistingFile()
|
|
|
|
|
{
|
|
|
|
|
$ffprobe = FFProbe::create();
|
2022-02-09 14:32:43 +01:00
|
|
|
$this->assertTrue($ffprobe->isValid(__DIR__.'/../files/sample.3gp'));
|
2017-09-19 19:28:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testValidateNonExistingFile()
|
|
|
|
|
{
|
|
|
|
|
$ffprobe = FFProbe::create();
|
2022-02-09 14:32:43 +01:00
|
|
|
$this->assertFalse($ffprobe->isValid(__DIR__.'/../files/WrongFile.mp4'));
|
2017-09-19 19:28:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testProbeOnNonExistantFile()
|
2013-08-05 14:36:27 +02:00
|
|
|
{
|
2020-02-13 00:23:11 +01:00
|
|
|
$this->expectException('\FFMpeg\Exception\RuntimeException');
|
|
|
|
|
|
2013-08-05 14:36:27 +02:00
|
|
|
$ffprobe = FFProbe::create();
|
|
|
|
|
$ffprobe->streams('/path/to/no/file');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testProbeOnRemoteFile()
|
|
|
|
|
{
|
|
|
|
|
$ffprobe = FFProbe::create();
|
2016-03-05 18:03:41 +01:00
|
|
|
$this->assertGreaterThan(0, count($ffprobe->streams('http://vjs.zencdn.net/v/oceans.mp4')));
|
2013-08-05 14:36:27 +02:00
|
|
|
}
|
|
|
|
|
}
|