Completed
Pull Request — develop (#27)
by Chris
04:25
created

TextStreamTest::dataProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Tests\Stream;
4
5
use PHPUnit\Framework\TestCase;
6
use Chrisyue\PhpM3u8\Stream\TextStream;
7
8
class TextStreamTest extends TestCase
9
{
10
    /**
11
     * @dataProvider dataProvider
12
     */
13
    public function test($text, $firstValid, $firstLine, $secondValid, $secondLine)
14
    {
15
        $stream = new TextStream($text);
16
        $this->assertSame($firstValid, $stream->isValid());
17
        $this->assertSame($firstLine, $stream->getLine());
18
19
        $stream->goNext();
20
        $this->assertSame($secondValid, $stream->isValid());
21
        $this->assertSame($secondLine, $stream->getLine());
22
    }
23
24
    public function dataProvider()
25
    {
26
        return [
27
            ["#TAG1\n#TAG2", true, '#TAG1', true, '#TAG2'],
28
            ["#TAG1", true, '#TAG1', false, false],
29
        ];
30
    }
31
}
32