FixerFactoryTest::provideCreateData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Symplify\MultiCodingStandard\Tests\PhpCsFixer\Factory;
6
7
use PhpCsFixer\Fixer\FixerInterface;
8
use PHPUnit\Framework\TestCase;
9
use Symplify\MultiCodingStandard\PhpCsFixer\Factory\FixerFactory;
10
11
final class FixerFactoryTest extends TestCase
12
{
13
    /**
14
     * @var FixerFactory
15
     */
16
    private $fixerFactory;
17
18
    protected function setUp()
19
    {
20
        $this->fixerFactory = new FixerFactory();
21
    }
22
23
    /**
24
     * @dataProvider provideCreateData
25
     */
26
    public function testResolveFixerLevels(
27
        array $fixerLevels,
28
        array $fixers,
29
        array $excludedFixers,
30
        int $expectedFixerCount
31
    ) {
32
        $fixers = $this->fixerFactory->createFromLevelsFixersAndExcludedFixers($fixerLevels, $fixers, $excludedFixers);
33
        $this->assertCount($expectedFixerCount, $fixers);
34
35
        if (count($fixers)) {
36
            $fixer = $fixers[0];
37
            $this->assertInstanceOf(FixerInterface::class, $fixer);
38
        }
39
    }
40
41
    public function provideCreateData() : array
42
    {
43
        return [
44
            [[], [], [], 0],
45
            [[], ['no_whitespace_before_comma_in_array'], [], 1],
46
            [['psr1'], [], [], 2],
47
            [['psr2'], [], [], 24],
48
            [['psr2'], [], ['visibility'],  24],
49
            [['psr1', 'psr2'], [], [], 26],
50
            [['psr1', 'psr2'], [], ['visibility'], 26],
51
        ];
52
    }
53
}
54