diff --git a/src/Extensions/Extension.php b/src/Extensions/Extension.php index f0bc396..dfa6b60 100644 --- a/src/Extensions/Extension.php +++ b/src/Extensions/Extension.php @@ -31,24 +31,24 @@ protected function incrementSuitesCounter(): void protected function suiteStarted(TestSuite $testSuite): void { - if (!$this->shouldRunTimeReport() || !class_exists($testSuite->getName())) { + if (!$this->shouldRunTimeReport() || !class_exists($testSuite->name())) { return; } $this->incrementSuitesCounter(); - $file = $this->extractFilenameFromClass($testSuite->getName()); + $file = $this->extractFilenameFromClass($testSuite->name()); $this->storeStartTime(StorageHandler::getRelativePathBasedOnTests($file)); } protected function suiteEnded(TestSuite $testSuite): void { - if (!$this->shouldRunTimeReport() || !class_exists($testSuite->getName())) { + if (!$this->shouldRunTimeReport() || !class_exists($testSuite->name())) { return; } - $file = $this->extractFilenameFromClass($testSuite->getName()); + $file = $this->extractFilenameFromClass($testSuite->name()); $this->storeEndTime( StorageHandler::getRelativePathBasedOnTests($file), diff --git a/src/Extensions/ExtensionV9.php b/src/Extensions/ExtensionV9.php deleted file mode 100644 index 989489c..0000000 --- a/src/Extensions/ExtensionV9.php +++ /dev/null @@ -1,24 +0,0 @@ -suiteStarted($testSuite); - } - - public function endTestSuite(TestSuite $testSuite): void - { - $this->suiteEnded($testSuite); - } -} diff --git a/src/PHPUnit/Configuration.php b/src/PHPUnit/Configuration.php index 10ec6c8..cd44360 100644 --- a/src/PHPUnit/Configuration.php +++ b/src/PHPUnit/Configuration.php @@ -40,8 +40,8 @@ public static function getPHPUnitConfigurationDirectory(): ?string global $argv; $configKey = array_search('--configuration', $argv, true); - if ($configKey !== false && isset($argv[$configKey + 1])) { - $configurationFile = realpath($argv[$configKey + 1]); + if ($configKey !== false && isset($argv[(int) $configKey + 1])) { + $configurationFile = realpath($argv[(int) $configKey + 1]); if (!$configurationFile) { return null; diff --git a/src/PHPUnit/NewFilesTestSuite.php b/src/PHPUnit/NewFilesTestSuite.php index 37e5fd2..28ade70 100644 --- a/src/PHPUnit/NewFilesTestSuite.php +++ b/src/PHPUnit/NewFilesTestSuite.php @@ -11,7 +11,6 @@ use Bellangelo\TestSuiteArchitect\ValueObjects\TestTimerCollection; use Exception; use PHPUnit\Framework\TestSuite; -use PHPUnit\Util\FileLoader; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use RuntimeException; @@ -30,14 +29,10 @@ protected static function addNewTestsForCurrentPartition( if (isset($partitions[$index])) { foreach ($partitions[$index] as $test) { try { - FileLoader::checkAndLoad($test->getName()); + $testSuite->addTestFile($test->getName()); } catch (Exception $e) { - // This can happen if a given class is not a test suite. - // TODO: Handle better such errors. continue; } - - $testSuite->addTestFile($test->getName()); } } } diff --git a/src/Storage/StorageHandler.php b/src/Storage/StorageHandler.php index a7ce5c4..55a79f3 100644 --- a/src/Storage/StorageHandler.php +++ b/src/Storage/StorageHandler.php @@ -62,8 +62,8 @@ private static function getRelativePath(string $from, string $to): string $to = rtrim(str_replace('\\', '/', $to), '/'); // Create arrays from paths and filter out empty values - $fromParts = array_filter(explode('/', $from), 'strlen'); - $toParts = array_filter(explode('/', $to), 'strlen'); + $fromParts = array_filter(explode('/', $from), null); + $toParts = array_filter(explode('/', $to), null); // Count of same path parts $samePartsCount = 0;