HEX
Server: nginx/1.28.3
System: Linux lightweb-s1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User: drdrivek-71 (1047)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/eslinced-103/brise-edu.or.kr/tests/Feature/Tenant/UserSettingsTest.php
<?php

namespace Tests\Feature\Tenant;

use PHPUnit\Framework\Attributes\Test;
use App\Models\User;
use Illuminate\Validation\ValidationException;
use Tests\TenantTestCase;

final class UserSettingsTest extends TenantTestCase
{
    #[Test]
    public function owner_cannot_use_a_different_tenants_email(): void
    {
        $tenant2 = $this->createTenant([
            'email' => 'second@tenant',
        ]);

        $this->expectException(ValidationException::class);
        $this->withoutExceptionHandling()->post(route('tenant.settings.user.personal'), [
            'name' => 'John Foo',
            'email' => 'second@tenant',
        ]);
    }

    #[Test]
    public function normal_user_can_use_a_different_tenants_email(): void
    {
        $tenant2 = $this->createTenant([
            'email' => 'second@tenant',
        ]);

        $user2 = User::factory()->create();
        $this->actingAs($user2);

        $this->withoutExceptionHandling()->post(route('tenant.settings.user.personal'), [
            'name' => 'John Foo',
            'email' => 'second@tenant',
        ])->assertRedirect();
    }
}