schickere bestellbestätigung und user role detaults auf "user" gesetzt.

This commit is contained in:
Codex Agent
2025-12-23 10:33:06 +01:00
parent ed5c1918fc
commit 886b24b06b
8 changed files with 409 additions and 12 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Tests\Feature;
use App\Models\Package;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Mail;
use Tests\TestCase;
class CheckoutRegisterRoleTest extends TestCase
{
use RefreshDatabase;
public function test_checkout_register_sets_user_role_until_purchase(): void
{
Mail::fake();
$package = Package::factory()->create();
$payload = [
'email' => 'buyer@example.test',
'username' => 'buyer',
'password' => 'Password!123',
'password_confirmation' => 'Password!123',
'first_name' => 'Soren',
'last_name' => 'Eberhardt',
'address' => 'Example Street 1',
'phone' => '123456789',
'package_id' => $package->id,
'terms' => true,
'privacy_consent' => true,
'locale' => 'de',
];
$response = $this->postJson('/checkout/register', $payload);
$response->assertOk();
$user = User::where('email', 'buyer@example.test')->first();
$this->assertNotNull($user);
$this->assertSame('user', $user->role);
}
}