Test Setup Failed
Push — next ( 738e04...b06172 )
by Jonathan
25:05
created

DocstringRepresentationTest::testConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Kint\Test\Object\Representation;
4
5
use Kint\Object\Representation\DocstringRepresentation;
6
use Kint\Test\KintTestCase;
7
8
class DocstringRepresentationTest extends KintTestCase
9
{
10
    /**
11
     * @covers \Kint\Object\Representation\DocstringRepresentation::__construct
12
     */
13
    public function testConstruct()
14
    {
15
        $r = new DocstringRepresentation('this is a string', 'filename', 123, 'classname');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
16
17
        $this->assertSame('this is a string', $r->contents);
18
        $this->assertSame('filename', $r->file);
19
        $this->assertSame(123, $r->line);
20
        $this->assertSame('classname', $r->class);
21
        $this->assertSame('docstring', $r->getName());
22
    }
23
24
    public function docstringProvider()
25
    {
26
        return array(
27
            'single line' => array(
28
                '/**
29
                  * @return wat
30
                  */',
31
                 '@return wat',
32
            ),
33
            'empty' => array(
34
                '',
35
                null,
36
            ),
37
            'bullets' => array(
38
                '/**
39
                  * * This is an item
40
                  * * This is another item
41
                  */',
42
                 "* This is an item\n* This is another item",
43
            ),
44
        );
45
    }
46
47
    /**
48
     * @covers \Kint\Object\Representation\DocstringRepresentation::getDocstringWithoutComments
49
     * @dataProvider docstringProvider
50
     */
51
    public function testGetDocstringWithoutComments($input, $expect)
52
    {
53
        $r = new DocstringRepresentation($input, null, null);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
54
55
        $this->assertSame($expect, $r->getDocstringWithoutComments());
56
    }
57
}
58