Skip to content

Fix tests for Filament v5 panel registration#57

Merged
stephenjude merged 1 commit into
5.xfrom
fix/filament-v5-test-setup
May 31, 2026
Merged

Fix tests for Filament v5 panel registration#57
stephenjude merged 1 commit into
5.xfrom
fix/filament-v5-test-setup

Conversation

@stephenjude

Copy link
Copy Markdown
Owner

Summary

Filament v5 (and Laravel 13) support was already declared in composer.json via #53 and #54, but the test suite was broken on v5: the registers plugin test crashed with Call to a member function plugin() on null because in v5 the current panel is only set by the SetUpPanel middleware during HTTP requests, so filament()->getCurrentPanel() returns null in unit tests.

  • tests/TestCase.php: call Filament::setCurrentPanel('admin') in setUp() so panel-dependent tests have a current panel.
  • phpunit.xml.dist: migrated to the PHPUnit 11/12 schema (removes deprecation warning, uses <source> instead of <coverage><include>, adds cacheDirectory).
  • .gitignore: ignore the new .phpunit.cache/ directory.

Verified locally against filament/filament 5.6.6, laravel/framework 13.12.0, orchestra/testbench 11.1.0: vendor/bin/pest passes 6/6, vendor/bin/pint --test passes.

In Filament v5 the current panel is only set by the SetUpPanel
middleware during HTTP requests, so filament()->getCurrentPanel()
returned null in unit tests and the "registers plugin" test failed
with "Call to a member function plugin() on null".

Also migrate phpunit.xml.dist to the PHPUnit 11/12 schema and
ignore the new .phpunit.cache directory.
@stephenjude stephenjude merged commit ffa7d36 into 5.x May 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant