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/Central/DomainsCannotBeUpdatedTest.php
<?php

namespace Tests\Feature\Central;

use App\Exceptions\DomainCannotBeChangedException;
use App\Models\Central\Domain;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

final class DomainsCannotBeUpdatedTest extends TestCase
{
    use DatabaseMigrations;

    #[Test]
    public function domain_attributes_can_be_changed(): void
    {
        $tenant = $this->createTenant();

        $domain = $tenant->createDomain('foo.localhost');

        /** @var Domain $domain */
        $domain->update([
            'is_primary' => true,
        ]);

        $this->assertSame(true, $domain->is_primary);
    }

    #[Test]
    public function domain_columns_cannot_be_changed(): void
    {
        $tenant = $this->createTenant();

        $this->expectException(DomainCannotBeChangedException::class);

        /** @var Domain $domain */
        $domain = $tenant->createDomain('foo.localhost');
        $domain->update([
            'domain' => 'bar.localhost',
        ]);
    }
}