Completed
Push — master ( 7a7d3a...83c752 )
by Jakub
01:47
created

ComposerTestSuitesFinder::getSuites()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 5

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 15
ccs 11
cts 11
cp 1
rs 9.6111
c 0
b 0
f 0
cc 5
nc 4
nop 1
crap 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MyTester;
6
7
/**
8
 * @author Jakub Konečný
9
 * @internal
10
 */
11
final class ComposerTestSuitesFinder extends BaseTestSuitesFinder
12
{
13 1
    public function getSuites(string $folder): array
14
    {
15 1
        $suites = [];
16 1
        $folder = (string) realpath($folder);
17 1
        $classMap = require \findVendorDirectory() . "/composer/autoload_classmap.php";
18 1
        foreach ($classMap as $class => $file) {
19 1
            $file = (string) realpath($file);
20 1
            if (!str_starts_with($file, $folder) || !str_ends_with($file, static::FILENAME_SUFFIX)) {
21 1
                continue;
22
            }
23 1
            if ($this->isTestSuite($class)) {
24 1
                $suites[] = $class;
25
            }
26
        }
27 1
        return $suites;
28
    }
29
}
30