mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Renamed DatasetAlreadyExists exception
This commit is contained in:
@ -12,7 +12,7 @@ use Symfony\Component\Console\Exception\ExceptionInterface;
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final class DatasetAlreadyExist extends InvalidArgumentException implements ExceptionInterface, RenderlessEditor, RenderlessTrace
|
final class DatasetAlreadyExists extends InvalidArgumentException implements ExceptionInterface, RenderlessEditor, RenderlessTrace
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new Exception instance.
|
* Creates a new Exception instance.
|
||||||
@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Repositories;
|
namespace Pest\Repositories;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Pest\Exceptions\DatasetAlreadyExist;
|
use Pest\Exceptions\DatasetAlreadyExists;
|
||||||
use Pest\Exceptions\DatasetDoesNotExist;
|
use Pest\Exceptions\DatasetDoesNotExist;
|
||||||
use Pest\Exceptions\ShouldNotHappen;
|
use Pest\Exceptions\ShouldNotHappen;
|
||||||
use SebastianBergmann\Exporter\Exporter;
|
use SebastianBergmann\Exporter\Exporter;
|
||||||
@ -43,7 +43,7 @@ final class DatasetsRepository
|
|||||||
$datasetKey = "$scope".self::SEPARATOR."$name";
|
$datasetKey = "$scope".self::SEPARATOR."$name";
|
||||||
|
|
||||||
if (array_key_exists("$datasetKey", self::$datasets)) {
|
if (array_key_exists("$datasetKey", self::$datasets)) {
|
||||||
throw new DatasetAlreadyExist($name, $scope);
|
throw new DatasetAlreadyExists($name, $scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$datasets[$datasetKey] = $data;
|
self::$datasets[$datasetKey] = $data;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Pest\Exceptions\DatasetAlreadyExist;
|
use Pest\Exceptions\DatasetAlreadyExists;
|
||||||
use Pest\Exceptions\DatasetDoesNotExist;
|
use Pest\Exceptions\DatasetDoesNotExist;
|
||||||
use Pest\Plugin;
|
use Pest\Plugin;
|
||||||
use Pest\Repositories\DatasetsRepository;
|
use Pest\Repositories\DatasetsRepository;
|
||||||
@ -18,7 +18,7 @@ it('throws exception if dataset does not exist', function () {
|
|||||||
|
|
||||||
it('throws exception if dataset already exist', function () {
|
it('throws exception if dataset already exist', function () {
|
||||||
DatasetsRepository::set('second', [[]], __DIR__);
|
DatasetsRepository::set('second', [[]], __DIR__);
|
||||||
$this->expectException(DatasetAlreadyExist::class);
|
$this->expectException(DatasetAlreadyExists::class);
|
||||||
$this->expectExceptionMessage('A dataset with the name `second` already exist in scope ['.__DIR__.'].');
|
$this->expectExceptionMessage('A dataset with the name `second` already exist in scope ['.__DIR__.'].');
|
||||||
DatasetsRepository::set('second', [[]], __DIR__);
|
DatasetsRepository::set('second', [[]], __DIR__);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user