Completed
Branch master (62d6ee)
by Adrian Florin
05:11 queued 02:52
created

ClassFinderTest::provideScenarios()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 28
rs 8.8571
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
namespace NeedleProject\Common;
3
4
class ClassFinderTest extends \PHPUnit_Framework_TestCase
5
{
6
    /**
7
     * @dataProvider provideScenarios
8
     * @param string $className
9
     * @param string $extension
0 ignored issues
show
Bug introduced by
There is no parameter named $extension. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
10
     * @param array $expectedFoundClasses
11
     */
12
    public function testClassSearch($className, $expectedFoundClasses)
13
    {
14
        $classFinder = new ClassFinder(
15
            realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR,
16
            $className
17
        );
18
19
        $foundClasses = $classFinder->findClasses();
20
        sort($foundClasses);
21
        sort($expectedFoundClasses);
22
        $this->assertEquals(
23
            $expectedFoundClasses,
24
            $foundClasses
25
        );
26
    }
27
28
    public function provideScenarios()
29
    {
30
        return [
31
            [
32
                \Fixture\BaseInterface::class,
33
                [
34
                    \Fixture\Path\ClassList\BazClass::class,
35
                    \Fixture\Path\ClassList\GodClass::class,
36
                    \Fixture\Path\FooClass::class
37
                ]
38
            ],
39
            [
40
                \Fixture\BaseClass::class,
41
                [
42
                    \Fixture\Path\ExtendsBaseClass::class
43
                ]
44
            ],
45
            [
46
                \Fixture\AbstractBase::class,
47
                [
48
                    \Fixture\Path\FooClass::class,
49
                    \Fixture\Path\ClassList\BarClass::class,
50
                    \Fixture\Path\ClassList\BazClass::class,
51
                    \Fixture\Path\ClassList\GodClass::class
52
                ]
53
            ]
54
        ];
55
    }
56
}
57