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

ComposerTestSuitesFinder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 11
dl 0
loc 17
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSuites() 0 15 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