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

namespace Tests\Feature\Central;

use PHPUnit\Framework\Attributes\Test;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Stancl\Tenancy\Contracts\TenantCouldNotBeIdentifiedException;
use Tests\TestCase;

final class RedirectOnNoTenantTest extends TestCase
{
    use DatabaseMigrations;

    #[Test]
    public function exception_is_thrown(): void
    {
        $this->expectException(TenantCouldNotBeIdentifiedException::class);

        $this->withoutExceptionHandling()
            ->get('http://foo.localhost');
    }

    #[Test]
    public function exception_is_handled(): void
    {
        $this->get('http://foo.localhost')
            ->assertRedirect('http://'.config('tenancy.central_domains')[0]);
    }
}