[BC] Upgraded dependencies, dropped support for anything below PHP 8.0. (#849)
* GitHub actions + style fixes + updated packages * Fixed workflows dir * Support for PHP 8.1 (#1) * Update README.md * Revert some changes from upstream
This commit is contained in:
parent
72c946dc7d
commit
111c153428
335 changed files with 4394 additions and 28116 deletions
13
tests/FFMpeg/Unit/Format/Audio/AacTest.php
Normal file
13
tests/FFMpeg/Unit/Format/Audio/AacTest.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\FFMpeg\Unit\Format\Audio;
|
||||
|
||||
use FFMpeg\Format\Audio\Aac;
|
||||
|
||||
class AacTest extends AudioTestCase
|
||||
{
|
||||
public function getFormat()
|
||||
{
|
||||
return new Aac();
|
||||
}
|
||||
}
|
||||
118
tests/FFMpeg/Unit/Format/Audio/AudioTestCase.php
Normal file
118
tests/FFMpeg/Unit/Format/Audio/AudioTestCase.php
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\FFMpeg\Unit\Format\Audio;
|
||||
|
||||
use FFMpeg\Format\Audio\DefaultAudio;
|
||||
use Tests\FFMpeg\Unit\TestCase;
|
||||
|
||||
abstract class AudioTestCase extends TestCase
|
||||
{
|
||||
public function testExtraParams()
|
||||
{
|
||||
$extraParams = $this->getFormat()->getExtraParams();
|
||||
|
||||
$this->assertIsArray($extraParams);
|
||||
|
||||
foreach ($extraParams as $param) {
|
||||
$this->assertScalar($param);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetAudioCodec()
|
||||
{
|
||||
$this->assertScalar($this->getFormat()->getAudioCodec());
|
||||
$this->assertContains($this->getFormat()->getAudioCodec(), $this->getFormat()->getAvailableAudioCodecs());
|
||||
}
|
||||
|
||||
public function testSetAudioCodec()
|
||||
{
|
||||
$format = $this->getFormat();
|
||||
|
||||
foreach ($format->getAvailableAudioCodecs() as $codec) {
|
||||
$format->setAudioCodec($codec);
|
||||
$this->assertEquals($codec, $format->getAudioCodec());
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetInvalidAudioCodec()
|
||||
{
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->getFormat()->setAudioCodec('invalid-random-audio-codec');
|
||||
}
|
||||
|
||||
public function testGetAvailableAudioCodecs()
|
||||
{
|
||||
$this->assertGreaterThan(0, count($this->getFormat()->getAvailableAudioCodecs()));
|
||||
}
|
||||
|
||||
public function testGetAudioKiloBitrate()
|
||||
{
|
||||
$this->assertIsInt($this->getFormat()->getAudioKiloBitrate());
|
||||
}
|
||||
|
||||
public function testSetAudioKiloBitrate()
|
||||
{
|
||||
$format = $this->getFormat();
|
||||
$format->setAudioKiloBitrate(256);
|
||||
$this->assertEquals(256, $format->getAudioKiloBitrate());
|
||||
}
|
||||
|
||||
public function testSetInvalidKiloBitrate()
|
||||
{
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->getFormat()->setAudioKiloBitrate(0);
|
||||
}
|
||||
|
||||
public function testSetNegativeKiloBitrate()
|
||||
{
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->getFormat()->setAudioKiloBitrate(-10);
|
||||
}
|
||||
|
||||
public function testGetAudioChannels()
|
||||
{
|
||||
$this->assertNull($this->getFormat()->getAudioChannels());
|
||||
}
|
||||
|
||||
public function testSetAudioChannels()
|
||||
{
|
||||
$format = $this->getFormat();
|
||||
$format->setAudioChannels(2);
|
||||
$this->assertEquals(2, $format->getAudioChannels());
|
||||
}
|
||||
|
||||
public function testSetInvalidChannels()
|
||||
{
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->getFormat()->setAudioChannels(0);
|
||||
}
|
||||
|
||||
public function testSetNegativeChannels()
|
||||
{
|
||||
$this->expectException('\FFMpeg\Exception\InvalidArgumentException');
|
||||
$this->getFormat()->setAudioChannels(-10);
|
||||
}
|
||||
|
||||
public function testCreateProgressListener()
|
||||
{
|
||||
$media = $this->getMockBuilder('FFMpeg\Media\MediaTypeInterface')->getMock();
|
||||
$media->expects($this->any())
|
||||
->method('getPathfile')
|
||||
->will($this->returnValue(__FILE__));
|
||||
$format = $this->getFormat();
|
||||
$ffprobe = $this->getFFProbeMock();
|
||||
|
||||
foreach ($format->createProgressListener($media, $ffprobe, 1, 3) as $listener) {
|
||||
$this->assertInstanceOf('FFMpeg\Format\ProgressListener\AudioProgressListener', $listener);
|
||||
$this->assertSame($ffprobe, $listener->getFFProbe());
|
||||
$this->assertSame(__FILE__, $listener->getPathfile());
|
||||
$this->assertSame(1, $listener->getCurrentPass());
|
||||
$this->assertSame(3, $listener->getTotalPass());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DefaultAudio
|
||||
*/
|
||||
abstract public function getFormat();
|
||||
}
|
||||
13
tests/FFMpeg/Unit/Format/Audio/FlacTest.php
Normal file
13
tests/FFMpeg/Unit/Format/Audio/FlacTest.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\FFMpeg\Unit\Format\Audio;
|
||||
|
||||
use FFMpeg\Format\Audio\Flac;
|
||||
|
||||
class FlacTest extends AudioTestCase
|
||||
{
|
||||
public function getFormat()
|
||||
{
|
||||
return new Flac();
|
||||
}
|
||||
}
|
||||
13
tests/FFMpeg/Unit/Format/Audio/Mp3Test.php
Normal file
13
tests/FFMpeg/Unit/Format/Audio/Mp3Test.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\FFMpeg\Unit\Format\Audio;
|
||||
|
||||
use FFMpeg\Format\Audio\Mp3;
|
||||
|
||||
class Mp3Test extends AudioTestCase
|
||||
{
|
||||
public function getFormat()
|
||||
{
|
||||
return new Mp3();
|
||||
}
|
||||
}
|
||||
13
tests/FFMpeg/Unit/Format/Audio/VorbisTest.php
Normal file
13
tests/FFMpeg/Unit/Format/Audio/VorbisTest.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\FFMpeg\Unit\Format\Audio;
|
||||
|
||||
use FFMpeg\Format\Audio\Vorbis;
|
||||
|
||||
class VorbisTest extends AudioTestCase
|
||||
{
|
||||
public function getFormat()
|
||||
{
|
||||
return new Vorbis();
|
||||
}
|
||||
}
|
||||
13
tests/FFMpeg/Unit/Format/Audio/WavTest.php
Normal file
13
tests/FFMpeg/Unit/Format/Audio/WavTest.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\FFMpeg\Unit\Format\Audio;
|
||||
|
||||
use FFMpeg\Format\Audio\Wav;
|
||||
|
||||
class WavTest extends AudioTestCase
|
||||
{
|
||||
public function getFormat()
|
||||
{
|
||||
return new Wav();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue