mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-08 12:02:47 +02:00
- Added `StreamInterface` to define the contract for stream handling. - Implemented `FileStream` class for file-based streaming. - Implemented `TextStream` class for in-memory text streaming. - Removed legacy `M3UParser` class and related resources. - Added new tests for `AttributeStringToArray`, `Iso8601Transformer`, `Resolution`, `Byterange`, `Inf`, `Line`, and `Lines` classes. - Updated bootstrap file to include new PhpM3u8 components.
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chrisyue\PhpM3u8\Test\Line;
|
|
|
|
use Chrisyue\PhpM3u8\Line\Line;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class LineTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider stringTransformationSamples
|
|
*/
|
|
public function testFromString($string, $expected): void
|
|
{
|
|
$line = Line::fromString($string);
|
|
|
|
$this->assertEquals($expected, $line);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider stringTransformationSamples
|
|
*/
|
|
public function testToString($string, Line $line = null): void
|
|
{
|
|
if (null === $line) {
|
|
$this->expectNotToPerformAssertions();
|
|
|
|
return;
|
|
}
|
|
|
|
$this->assertEquals($string, (string) $line);
|
|
}
|
|
|
|
public function stringTransformationSamples(): array
|
|
{
|
|
return [
|
|
['#foo:bar', null],
|
|
['#EXT-FOO', new Line('EXT-FOO', true)],
|
|
['bar', new Line(null, 'bar')],
|
|
[' ', null],
|
|
['#', null],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @dataProvider typeSamples
|
|
*/
|
|
public function testIsType(Line $line, $type): void
|
|
{
|
|
$this->assertTrue($line->isType($type));
|
|
}
|
|
|
|
public function typeSamples(): array
|
|
{
|
|
return [
|
|
[new Line('foo', 'bar'), Line::TYPE_TAG],
|
|
[new Line(null, 'foobar'), Line::TYPE_URI],
|
|
];
|
|
}
|
|
}
|