From 8d0a0b8cc6a50763bd3e37852f4137a5b2fbd1da Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 16 Nov 2026 08:45:16 +0100 Subject: [PATCH] Lege das Pruefkonto ohne Faker an Co-authored-by: Cursor --- app/Console/Commands/SeedLibraryReview.php | 24 +++++++++++++++++++--- tests/Feature/LibraryCompletionTest.php | 1 + 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/SeedLibraryReview.php b/app/Console/Commands/SeedLibraryReview.php index ed48bbd..f989547 100644 --- a/app/Console/Commands/SeedLibraryReview.php +++ b/app/Console/Commands/SeedLibraryReview.php @@ -10,9 +10,12 @@ use App\Domain\Catalog\Offer; use App\Domain\Catalog\OfferService; use App\Domain\Entitlement\GrantIssuer; +use App\Domain\Identity\AccountStatus; +use App\Domain\Identity\Party; +use App\Domain\Identity\PartyType; +use App\Domain\Identity\Profile; use App\Models\User; use Illuminate\Console\Command; -use Illuminate\Support\Facades\Hash; class SeedLibraryReview extends Command { @@ -105,11 +108,26 @@ private function ensureTrainer(): void $trainer = User::query()->where('email', 'trainer-pruefung@example.test')->first(); if ($trainer === null) { - $trainer = User::factory()->create([ + $party = Party::query()->create([ + 'type' => PartyType::Person, + 'display_name' => 'Trainer Prüfung', + ]); + Profile::query()->create([ + 'party_id' => $party->id, + 'display_name' => 'Trainer Prüfung', + 'visibility' => ['display_name' => 'private'], + ]); + $trainer = new User; + $trainer->forceFill([ + 'party_id' => $party->id, 'name' => 'Trainer Prüfung', 'email' => 'trainer-pruefung@example.test', - 'password' => Hash::make('Kursraum-Pruefung'), + 'password' => 'Kursraum-Pruefung', + 'status' => AccountStatus::Aktiv, + 'confirmed_adult_at' => now(), + 'email_verified_at' => now(), ]); + $trainer->save(); } $offer = Offer::query()->where('name', 'Prüfprogramm Abstand')->first(); diff --git a/tests/Feature/LibraryCompletionTest.php b/tests/Feature/LibraryCompletionTest.php index 27280bb..b34e439 100644 --- a/tests/Feature/LibraryCompletionTest.php +++ b/tests/Feature/LibraryCompletionTest.php @@ -72,5 +72,6 @@ public function test_review_fixture_can_be_repeated(): void $this->artisan('library:review-fixture', ['--actor' => $actor->id])->assertSuccessful(); $this->assertSame(1, Composition::query()->where('designation', 'Prüfprogramm Abstand')->count()); + $this->assertNotNull(User::query()->where('email', 'trainer-pruefung@example.test')->first()); } }