Repository navigation
chore(phpstan): enable level 4 for tests/ - #1891
Merged
Merged
Conversation
Fix the level 4 findings in tests/ and remove the last entries from the phpstan_next exclude list: - Fix ScheduleReservationListTest asserting on slot 0 instead of slot 4, the FakePaymentRepository save that never stored the result and FakeUploadedFile::Error() missing its return. - Drop write-only test properties and unused helpers, including ExistingReservationSeriesBuilder::WithResources() and the always-skipped ImportICalPresenterTest::testParseIcs() with its fixture. - Add failing default arms to match expressions in PHPUnit callbacks. - Remove assertions that cannot fail and use addToAssertionCount() where a test only checks that no exception is thrown. - Simplify checks on values that cannot be false or missing in the integration server helpers, and check disable_functions for proc_open instead of is_callable(). - Annotate the legacy $conf array and narrow closure return types. Assisted-by: Claude:claude-opus-5-5
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes address the remaining PHPStan findings, correct test doubles and assertions, remove obsolete scaffolding, and eliminate the outstanding test exclusions without any active review issues identified.
No open issues 🎉
What changed in this PR
This pull request enables PHPStan level 4 analysis for the test suite by fixing remaining findings, correcting test doubles and assertions, removing obsolete scaffolding, and clearing the final test exclusions.
Changes:
- Corrects fake repository/upload behavior and a schedule-slot assertion.
- Removes unused properties, helpers, skipped tests, and an obsolete iCalendar fixture.
- Adds exhaustive callback handling, improves assertion counting, narrows types, and simplifies integration checks.
- Removes the remaining
tests/exclusions fromphpstan_next.neon.
| File | Description |
|---|---|
tests/src/Application/Admin/ServerEnvironmentTest.php |
Narrows test closure return types. |
tests/Presenters/SearchAvailabilityPresenterTest.php |
Removes unused reservation and blackout helpers. |
tests/Presenters/Reservation/ReservationUpdatePresenterTest.php |
Removes unused user ID state. |
tests/Presenters/Reservation/ReservationSavePresenterTest.php |
Removes unused user ID state. |
tests/Presenters/Reservation/ReservationMovePresenterTest.php |
Removes unused user ID state. |
tests/Presenters/Reservation/ReservationEmailPresenterTest.php |
Removes unused user state and setup. |
tests/Presenters/Reservation/ReservationDeletePresenterTest.php |
Removes unused user ID state. |
tests/Presenters/Reservation/NewReservationPresenterTest.php |
Removes unused user ID state. |
tests/Presenters/Reservation/ExistingReservationInitializerTest.php |
Removes unused user ID state. |
tests/Presenters/Reservation/EditReservationPresenterTest.php |
Removes unused user ID state. |
tests/Presenters/PersonalCalendarPresenterTest.php |
Removes an unused calendar factory mock. |
tests/Presenters/Dashboard/UpcomingReservationsPresenterTest.php |
Removes an unused presenter property. |
tests/Presenters/CalendarPresenterTest.php |
Removes an unused calendar factory mock. |
tests/Presenters/Admin/MyCal.ics |
Removes the obsolete skipped-test fixture. |
tests/Presenters/Admin/ManageUsersPresenterTest.php |
Adds an exhaustive callback match arm. |
tests/Presenters/Admin/ManageSchedulesPresenterTest.php |
Adds an exhaustive callback match arm. |
tests/Presenters/Admin/ManageReservationsPresenterTest.php |
Adds exhaustive callback handling. |
tests/Presenters/Admin/ManageConfigurationPresenterTest.php |
Removes an unused assertion helper. |
tests/Presenters/Admin/ImportICalPresenterTest.php |
Removes an always-skipped test. |
tests/Plugins/Authentication/PluginConfigLoadingTest.php |
Uses explicit assertion counting for no-exception checks. |
tests/Plugins/Authentication/Ldap/LdapTest.php |
Removes unused encryption setup. |
tests/Plugins/Authentication/ActiveDirectory/ActiveDirectoryTest.php |
Removes unused test dependencies. |
tests/Integration/SmokeTest.php |
Improves disabled-function detection and status handling. |
tests/Integration/router.php |
Simplifies checks for guaranteed values. |
tests/Infrastructure/Database/DatabaseTest.php |
Removes an assertion that could not fail. |
tests/Infrastructure/Config/EnableSubscriptionTest.php |
Annotates the legacy configuration array. |
tests/Infrastructure/Config/ConfigTest.php |
Annotates the legacy configuration array. |
tests/Infrastructure/Common/URIParamValidatorTest.php |
Adds an exhaustive validator match arm. |
tests/Infrastructure/Common/SmartyControlTest.php |
Removes unused style state. |
tests/Infrastructure/Common/DateTest.php |
Removes unused timezone state. |
tests/fakes/FakeUploadedFile.php |
Returns the configured upload error. |
tests/fakes/FakePaymentRepository.php |
Stores the last PayPal payment result. |
tests/fakes/ExistingReservationSeriesBuilder.php |
Removes unused resource state and its builder method. |
tests/Application/Schedule/ScheduleReservationListTest.php |
Corrects the buffer-slot assertion index. |
tests/Application/Schedule/ResourceServiceTest.php |
Adds exhaustive callback handling. |
tests/Application/Reservation/SchedulePeriodRuleTest.php |
Makes callback handling exhaustive and narrows return logic. |
tests/Application/Reservation/ReservationComponentTest.php |
Removes an unused attribute repository mock. |
tests/Application/Authentication/AuthenticationTest.php |
Removes unused authentication test state. |
phpstan_next.neon |
Removes the remaining test-directory exclusions. |
This pull request is too complex or risky for automated approval.
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the level 4 findings in tests/ and remove the last entries from the phpstan_next exclude list:
Assisted-by: Claude:claude-opus-5-5