| Conditions | 6 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 6.0359 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 1 | public function getSuites(string $folder): array |
|
| 20 | { |
||
| 21 | 1 | if (!$this->isAvailable()) { |
|
| 22 | return []; |
||
| 23 | } |
||
| 24 | 1 | $suites = []; |
|
| 25 | 1 | $robot = new RobotLoader(); |
|
| 26 | 1 | $tempDir = "$folder/temp/cache/Robot.Loader"; |
|
| 27 | 1 | FileSystem::createDir($tempDir); |
|
| 28 | 1 | $robot->setTempDirectory($tempDir); |
|
| 29 | 1 | $robot->addDirectory($folder); |
|
| 30 | 1 | $robot->acceptFiles = ["*Test.php", ]; |
|
| 31 | 1 | $robot->rebuild(); |
|
| 32 | 1 | $robot->register(); |
|
| 33 | 1 | $classes = $robot->getIndexedClasses(); |
|
| 34 | 1 | foreach ($classes as $class => $file) { |
|
| 35 | 1 | if (!class_exists($class)) { |
|
| 36 | continue; |
||
| 37 | } |
||
| 38 | 1 | $rc = new ReflectionClass($class); |
|
| 39 | 1 | if (!$rc->isAbstract() && $rc->isSubclassOf(TestCase::class)) { |
|
| 40 | 1 | $suites[] = $rc->getName(); |
|
| 41 | } |
||
| 42 | } |
||
| 43 | 1 | return $suites; |
|
| 44 | } |
||
| 51 |