Passed
Push — master ( f195ba...c3313b )
by Gerrit
01:29
created

shouldHaveAFixerDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
dl 17
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of PHP CS Fixer.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *     Dariusz Rumiński <[email protected]>
8
 *
9
 * This source file is subject to the MIT license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Addiks\MorePhpCsFixers\Tests\Unit\DocComment;
14
15
use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
16
use PhpCsFixer\FixerDefinition\FixerDefinition;
17
use PhpCsFixer\FixerDefinition\CodeSample;
18
use Addiks\MorePhpCsFixers\DocComment\ArrayInDocCommentFixer;
19
20
/**
21
 * @internal
22
 */
23 View Code Duplication
final class ArrayInDocCommentFixerTest extends AbstractFixerTestCase
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...
24
{
25
    /**
26
     * @param string      $expected
27
     * @param null|string $input
28
     *
29
     * @dataProvider provideFixCases
30
     */
31
    public function testFix($expected, $input = null)
32
    {
33
        $this->doTest($expected, $input);
34
    }
35
36
    public function provideFixCases()
37
    {
38
        return [
39
            [
40
                '<?php
41
/** @var array<string> $foo */
42
/** @var array<int> $foo */
43
/** @var array<Foo> $foo */
44
/** @var array<Foo\Bar> $foo */
45
/** @var array<\Foo> $foo */
46
/**
47
 * @var array<Foo> $foo
48
 */
49
',
50
            ],
51
            [
52
                '<?php
53
/** @var array<string> $foo */
54
/** @var array<int> $foo */
55
/** @var array<Foo> $foo */
56
/** @var array<Foo\Bar> $foo */
57
/** @var array<\Foo> $foo */
58
/**
59
 * @var array<Foo> $foo
60
 */
61
',
62
                '<?php
63
/** @var string[] $foo */
64
/** @var int[] $foo */
65
/** @var Foo[] $foo */
66
/** @var Foo\Bar[] $foo */
67
/** @var \Foo[] $foo */
68
/**
69
 * @var Foo[] $foo
70
 */
71
',
72
            ],
73
            [
74
                '<?php
75
    /** @var array<string> $foo */
76
    /** @var array<int> $foo */
77
    /** @var array<Foo> $foo */
78
    /** @var array<Foo\Bar> $foo */
79
    /** @var array<\Foo> $foo */
80
    /**
81
     * @var array<Foo> $foo
82
     */
83
',
84
                '<?php
85
    /** @var string[] $foo */
86
    /** @var int[] $foo */
87
    /** @var Foo[] $foo */
88
    /** @var Foo\Bar[] $foo */
89
    /** @var \Foo[] $foo */
90
    /**
91
     * @var Foo[] $foo
92
     */
93
',
94
            ],
95
        ];
96
    }
97
98
    /**
99
     * @test
100
     */
101
    public function shouldHaveAFixerDefinition()
102
    {
103
        $this->assertEquals(
104
            new FixerDefinition(
105
                'Normalizes array-notations in doccomments.',
106
                [
107
                    new CodeSample(
108
                        '<?php
109
110
/** @var array<string> $foo */
111
'
112
                    ),
113
                ]
114
            ),
115
            $this->createFixer()->getDefinition()
116
        );
117
    }
118
119
    protected function createFixer()
120
    {
121
        return new ArrayInDocCommentFixer();
122
    }
123
124
}
125