Files
landing-api/tests/Feature/Panel/EnvironmentBannerTest.php
Josep Piguillem 3897113313 Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer
collective, backed by the Pireon OAuth identity server. The public site is a
separate, server-rendered application consuming /api/public/v1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 17:55:27 +02:00

69 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\Panel;
use Database\Seeders\RolePermissionSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\Attributes\Test;
use Tests\FakesPireon;
use Tests\TestCase;
/**
* The one banner that has to be right in the one direction that matters.
*
* Nobody edits a local clone carefully because they mistake it for
* production — the expensive mistake runs the other way. So the only
* environment that stays silent is `local`; every other one says so, and
* production says so the loudest.
*/
class EnvironmentBannerTest extends TestCase
{
use FakesPireon, RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->seed(RolePermissionSeeder::class);
$this->actingAs($this->userWithRoles('admin'));
}
protected function setEnvironment(string $environment): void
{
$this->app['env'] = $environment;
}
#[Test]
public function nothing_is_shown_in_a_local_install(): void
{
$this->setEnvironment('local');
$this->get('/admin')
->assertOk()
->assertDontSee(__('panel.environment.production'))
->assertDontSeeText('bg-danger-600', escape: false);
}
#[Test]
public function production_says_so_in_the_loudest_colour(): void
{
$this->setEnvironment('production');
$this->get('/admin')
->assertOk()
->assertSee(__('panel.environment.production'));
}
#[Test]
public function anything_else_names_itself(): void
{
$this->setEnvironment('staging');
$this->get('/admin')
->assertOk()
->assertSee(__('panel.environment.other', ['name' => 'staging']));
}
}