mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
Add DatasetInfo support class
This commit is contained in:
@ -9,8 +9,8 @@ use Pest\PendingCalls\TestCall;
|
||||
use Pest\PendingCalls\UsesCall;
|
||||
use Pest\Repositories\DatasetsRepository;
|
||||
use Pest\Support\Backtrace;
|
||||
use Pest\Support\DatasetInfo;
|
||||
use Pest\Support\HigherOrderTapProxy;
|
||||
use Pest\Support\Str;
|
||||
use Pest\TestSuite;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@ -61,16 +61,7 @@ if (! function_exists('dataset')) {
|
||||
*/
|
||||
function dataset(string $name, Closure|iterable $dataset): void
|
||||
{
|
||||
$file = Backtrace::datasetsFile();
|
||||
$filename = Str::afterLast($file, DIRECTORY_SEPARATOR);
|
||||
$scope = Str::beforeLast($file, DIRECTORY_SEPARATOR);
|
||||
|
||||
if (Str::afterLast($scope, DIRECTORY_SEPARATOR) === 'Datasets') {
|
||||
$scope = Str::beforeLast($scope, DIRECTORY_SEPARATOR);
|
||||
} elseif ($filename !== 'Datasets.php') {
|
||||
$scope = $file;
|
||||
}
|
||||
|
||||
$scope = DatasetInfo::scope(Backtrace::datasetsFile());
|
||||
DatasetsRepository::set($name, $dataset, $scope);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user