admin = User::factory()->create(); $this->admin->roles()->create(['name' => 'Admin', 'slug' => 'admin']); } public function test_admin_can_view_themes_list() { $response = $this->actingAs($this->admin) ->get('/loom/themes'); $response->assertStatus(200); $response->assertViewHas('themes'); $response->assertViewHas('activeTheme'); } public function test_admin_can_activate_theme() { // Initial state Setting::set('active_theme', 'icehouse', 'cms'); $response = $this->actingAs($this->admin) ->post('/loom/themes/activate', [ 'theme' => 'royal' ]); $response->assertStatus(200); $response->assertJsonPath('active_theme', 'royal'); $this->assertEquals('royal', Setting::get('active_theme')); } public function test_cannot_activate_non_existent_theme() { $response = $this->actingAs($this->admin) ->postJson('/loom/themes/activate', [ 'theme' => 'non-existent-theme' ]); $response->assertStatus(404); } }