*/ private static function directorySegmentsInsideTestsDirectory(string $file): array { $directory = dirname(self::pathInsideTestsDirectory($file)); if ($directory === '.' || $directory === DIRECTORY_SEPARATOR) { return []; } return array_values(array_filter( explode(DIRECTORY_SEPARATOR, trim($directory, DIRECTORY_SEPARATOR)), static fn (string $segment): bool => $segment !== '', )); } private static function pathInsideTestsDirectory(string $file): string { $testsDirectory = DIRECTORY_SEPARATOR.trim(testDirectory(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; $position = strrpos($file, $testsDirectory); if ($position === false) { return $file; } return substr($file, $position + strlen($testsDirectory)); } private static function testsDirectoryPath(string $file): string { $testsDirectory = DIRECTORY_SEPARATOR.trim(testDirectory(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; $position = strrpos($file, $testsDirectory); if ($position === false) { return dirname($file); } return substr($file, 0, $position + strlen($testsDirectory) - 1); } }