add config loader to read phpunit file and get the tests directory or fallback

This commit is contained in:
danilopolani
2022-03-30 15:39:50 +02:00
parent db5c11d96e
commit 80c411be44
3 changed files with 132 additions and 1 deletions

View File

@ -58,4 +58,22 @@ final class Str
return (string) preg_replace('/[^A-Z_a-z0-9\\\\]/', '', $code);
}
/**
* Get the portion of a string before the last occurrence of a given value.
*/
public static function beforeLast(string $subject, string $search): string
{
if ($search === '') {
return $subject;
}
$pos = mb_strrpos($subject, $search);
if ($pos === false) {
return $subject;
}
return substr($subject, 0, $pos);
}
}