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

TextStreamTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test() 0 10 1
A dataProvider() 0 7 1
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Tests\Stream;
4
5
use Chrisyue\PhpM3u8\Stream\TextStream;
6
use PHPUnit\Framework\TestCase;
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