feat: add admin env badge, quick post button, and harden plugin enable
Build and Deploy / verify (push) Failing after 15m17s
Build and Deploy / deploy (push) Skipped

Show local/prod in the Filament topbar, jump to create post in one click, tighten sidebar spacing, and stop Hello World from 500ing when its tables are missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-18 08:24:16 +00:00
co-authored by Cursor
parent b39423831c
commit 469160dc3f
19 changed files with 825 additions and 43 deletions
+32
View File
@@ -71,4 +71,36 @@ class AdminPagesTest extends TestCase
{
$this->get('/admin')->assertRedirect('/admin/login');
}
public function test_admin_environment_maps_production_to_prod(): void
{
$original = app()->environment();
app()['env'] = 'production';
$this->assertSame('prod', \App\Filament\Support\AdminEnvironment::name());
$this->assertSame('danger', \App\Filament\Support\AdminEnvironment::color());
app()['env'] = $original;
}
public function test_admin_topbar_shows_environment_and_create_post_button(): void
{
$this->actingAs($this->admin)
->get('/admin')
->assertOk()
->assertSee(\App\Filament\Support\AdminEnvironment::name(), false)
->assertSee('写文章', false)
->assertSee('/admin/posts/create', false);
}
public function test_hello_world_plugin_pages_load_when_enabled(): void
{
$manager = app(\App\Blog\Support\PluginManager::class);
$manager->enable('demo.hello-world');
\Plugins\Demo\HelloWorld\ServiceProvider::bootPlugin($manager);
$this->actingAs($this->admin)->get('/admin')->assertOk();
$this->actingAs($this->admin)->get('/admin/posts/create')->assertOk();
$this->get('/hello-world')->assertOk();
}
}
+20
View File
@@ -67,4 +67,24 @@ class DemoPluginTest extends TestCase
->assertOk()
->assertSee('Hello World 演示页');
}
public function test_hello_world_page_survives_missing_log_table(): void
{
\Illuminate\Support\Facades\Schema::dropIfExists('hello_world_logs');
$this->get('/hello-world')->assertOk()->assertSee('Hello World 演示页');
}
public function test_enable_hello_world_runs_plugin_migrations(): void
{
\Illuminate\Support\Facades\Schema::dropIfExists('hello_world_logs');
\Illuminate\Support\Facades\DB::table('migrations')
->where('migration', 'like', '%hello_world_logs%')
->delete();
app(PluginManager::class)->enable('demo.hello-world');
$this->assertTrue(\Illuminate\Support\Facades\Schema::hasTable('hello_world_logs'));
$this->assertTrue(app(PluginManager::class)->isEnabled('demo.hello-world'));
}
}