feat: add admin env badge, quick post button, and harden plugin enable
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user