From 6cf75b112092c8b5671e9e41871abc33f47ac45a Mon Sep 17 00:00:00 2001 From: Ruben Van Assche Date: Fri, 15 Sep 2023 11:44:39 +0200 Subject: [PATCH] Fix docs --- docs/as-a-data-transfer-object/casts.md | 8 ++++---- tests/ValidationTest.php | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/as-a-data-transfer-object/casts.md b/docs/as-a-data-transfer-object/casts.md index 28ba24ce..080bbe53 100644 --- a/docs/as-a-data-transfer-object/casts.md +++ b/docs/as-a-data-transfer-object/casts.md @@ -21,10 +21,10 @@ class SongData extends Data The `Format` property here is an `Enum` and looks like this: ```php -enum Format { - case cd; - case vinyl; - case cassette; +enum Format: string { + case cd = 'cd'; + case vinyl = 'vinyl'; + case cassette = 'cassette'; } ``` diff --git a/tests/ValidationTest.php b/tests/ValidationTest.php index 9917cf62..8bd89be3 100644 --- a/tests/ValidationTest.php +++ b/tests/ValidationTest.php @@ -6,22 +6,21 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Foundation\Application; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Validator as ValidatorFacade; use Illuminate\Validation\Rules\Enum; use Illuminate\Validation\Rules\Exists as LaravelExists; use Illuminate\Validation\Rules\In as LaravelIn; use Illuminate\Validation\ValidationException; use Illuminate\Validation\Validator; - -use function Pest\Laravel\mock; -use function PHPUnit\Framework\assertFalse; - use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapName; +use Spatie\LaravelData\Attributes\MapOutputName; use Spatie\LaravelData\Attributes\Validation\ArrayType; use Spatie\LaravelData\Attributes\Validation\Bail; use Spatie\LaravelData\Attributes\Validation\BooleanType; +use Spatie\LaravelData\Attributes\Validation\Email; use Spatie\LaravelData\Attributes\Validation\Exists; use Spatie\LaravelData\Attributes\Validation\In; use Spatie\LaravelData\Attributes\Validation\IntegerType; @@ -69,6 +68,8 @@ use Spatie\LaravelData\Tests\Fakes\Support\FakeInjectable; use Spatie\LaravelData\Tests\Fakes\ValidationAttributes\PassThroughCustomValidationAttribute; use Spatie\LaravelData\Tests\TestSupport\DataValidationAsserter; +use function Pest\Laravel\mock; +use function PHPUnit\Framework\assertFalse; it('can validate a string', function () { $dataClass = new class () extends Data {