for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Chrisyue\PhpM3u8\Tests\Stream;
use PHPUnit\Framework\TestCase;
use Chrisyue\PhpM3u8\Stream\TextStream;
class TextStreamTest extends TestCase
{
/**
* @dataProvider dataProvider
*/
public function test($text, $firstValid, $firstInfo, $secondValid, $secondInfo)
$stream = new TextStream($text);
$this->assertSame($firstValid, $stream->valid());
$this->assertSame($firstInfo, $stream->read());
$stream->next();
$this->assertSame($secondValid, $stream->valid());
$this->assertSame($secondInfo, $stream->read());
}
public function dataProvider()
return [
["#TAG1\n#TAG2", true, ['tag' => '#TAG1', 'value' => ''], true, ['tag' => '#TAG2', 'value' => '']],
["#TAG1", true, ['tag' => '#TAG1', 'value' => ''], false, null],
];