Skip to content

Add Filament admin CRUD tests for all resources and the Settings page - #2564

Merged
lancepioch merged 2 commits into
mainfrom
w5-filament-crud
Sep 12, 2026
Merged

lancepioch merged 2 commits into
mainfrom
w5-filament-crud

Conversation

@lancepioch

Copy link
Copy Markdown
Member

Summary

  • Adds create, edit, delete, validation-error, and negative-authorization tests for every admin resource: Servers, Nodes, Users, Eggs, Mounts, BackupHosts, DatabaseHosts, Roles, Webhooks, and ApiKeys, following the existing ListNodesTest pattern.
  • Adds Settings page tests: renders for root admin, forbidden without permission, and save persists to the environment file.
  • EnvironmentWriterTrait now writes to app()->environmentFilePath() instead of hardcoded base_path('.env'), which is identical in production but lets the settings test redirect writes to a scratch file via useEnvironmentPath().
  • Wings calls are mocked through DaemonServerRepository (same pattern as ServerCreationServiceTest); the database host connection check is faked with a proxied partial of the database manager so the panel's own connection stays real.

Raises tests/Filament from 43 to 92 tests. Part of the W5 critical-path test coverage work; a follow-up PR covers the Application API endpoints.

Test plan

  • vendor/bin/pest tests/Filament --parallel passes (92 tests).
  • vendor/bin/pest tests/Integration --parallel still passes (the trait change is exercised by the installer tests).

Every admin resource now has create, edit, delete, validation, and
negative-authorization coverage: Servers, Nodes, Users, Eggs, Mounts,
BackupHosts, DatabaseHosts, Roles, Webhooks, and ApiKeys, plus render,
authorization, and save-persistence tests for the Settings page.

Wings calls are mocked through DaemonServerRepository like the existing
service tests, and the database host connection check is faked with a
proxied partial of the database manager so the panel connection stays
real. EnvironmentWriterTrait now resolves the env file through
app()->environmentFilePath() instead of a hardcoded base_path('.env'),
which behaves identically in production and lets the settings test point
writes at a scratch file.
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6c0b83c7-f19a-4339-8806-8e54d803412d

📥 Commits

Reviewing files that changed from the base of the PR and between ab651d5 and 0729ae3.

📒 Files selected for processing (1)
  • app/Traits/EnvironmentWriterTrait.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/Traits/EnvironmentWriterTrait.php

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change makes environment writes use the configured application environment path. It adds Filament tests for settings and admin CRUD flows, including validation, persistence, deletion, external-call handling, and permission enforcement.

Changes

Admin panel coverage

Layer / File(s) Summary
Environment settings persistence
app/Traits/EnvironmentWriterTrait.php, tests/Filament/Admin/SettingsTest.php
Environment writes use App::environmentFilePath(). Settings tests verify rendering, authorization, and persistence.
Access and identity resources
tests/Filament/Admin/ApiKeyTest.php, tests/Filament/Admin/RoleCrudTest.php, tests/Filament/Admin/UserCrudTest.php, tests/Filament/Admin/WebhookCrudTest.php
Tests cover API keys, roles, users, and webhooks across CRUD, validation, persistence, deletion, and authorization flows.
Backup and database host resources
tests/Filament/Admin/BackupHostCrudTest.php, tests/Filament/Admin/DatabaseHostCrudTest.php
Tests cover host CRUD, required fields, remote connection failure handling, persistence, and authorization.
Compute and storage resources
tests/Filament/Admin/EggCrudTest.php, tests/Filament/Admin/MountCrudTest.php, tests/Filament/Admin/NodeCrudTest.php, tests/Filament/Admin/ServerCrudTest.php
Tests cover CRUD operations, validation, persistence, daemon interaction boundaries, and permission enforcement for eggs, mounts, nodes, and servers.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0729a

Environment settings now use the configured application environment-file path, while the change adds admin and settings coverage. No concrete merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately summarizes the added Filament CRUD and Settings tests, the EnvironmentWriterTrait change, mocking strategy, and test results.
Title check ✅ Passed The title clearly identifies the main change: adding Filament admin CRUD tests and Settings page tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 12 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lancepioch lancepioch self-assigned this Sep 9, 2026
The custom PHPStan rule forbids the app() global.
@lancepioch
lancepioch merged commit 13974c4 into main Sep 12, 2026
17 checks passed
@lancepioch
lancepioch deleted the w5-filament-crud branch September 12, 2026 15:47
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants