Completed
Pull Request — develop (#27)
by Chris
01:41
created

ByterangeTest::testReverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Tests\M3u8\Transformer;
4
5
use Chrisyue\PhpM3u8\Document\Rfc8216\Tag;
6
use Chrisyue\PhpM3u8\M3u8\Transformer\Byterange;
7
use PHPUnit\Framework\TestCase;
8
9 View Code Duplication
class ByterangeTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    /**
12
     * @dataProvider dataProvider
13
     */
14
    public function testTransform($origin, $transformed)
15
    {
16
        $transformer = new Byterange();
17
18
        $this->assertEquals($transformed, $transformer->transform($origin));
19
    }
20
21
    /**
22
     * @dataProvider dataProvider
23
     */
24
    public function testReverse($origin, $transformed)
25
    {
26
        $transformer = new Byterange();
27
28
        $this->assertSame($origin, $transformer->reverse($transformed));
29
    }
30
31
    public function dataProvider()
32
    {
33
        $data = [];
34
35
        $origin = '100';
36
        $transformed = new Tag\Byterange();
37
        $transformed->length = 100;
38
39
        $data[] = [$origin, $transformed];
40
41
        $origin = '222@333';
42
        $transformed = new Tag\Byterange();
43
        $transformed->length = 222;
44
        $transformed->offset = 333;
45
46
        $data[] = [$origin, $transformed];
47
48
        return $data;
49
    }
50
}
51