Files
XC_VM/tests/Unit/PhpM3u8/Line/LineTest.php
T
Divarion_D 758a9cab0b style: apply K&R + tab formatting across the codebase (make cs-fix)
Mechanical, behaviour-preserving reformat produced by 'make cs-fix' under
the new build/phpcs.xml.dist ruleset: K&R braces, tab indentation, and the
other whitespace normalisations. No logic changes.
2026-09-13 14:14:23 +03:00

56 lines
1.3 KiB
PHP

<?php
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 static 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 static function typeSamples(): array {
return [
[new Line('foo', 'bar'), Line::TYPE_TAG],
[new Line(null, 'foobar'), Line::TYPE_URI],
];
}
}