Skip to content

Collect can_view_default_users_list, and drop its copy-pasted filter - #5404

Open
dylanpulver wants to merge 1 commit into
flarum:2.xfrom
dylanpulver:fix/collect-can-view-default-users-list
Open

dylanpulver wants to merge 1 commit into
flarum:2.xfrom
dylanpulver:fix/collect-can-view-default-users-list

Conversation

@dylanpulver

Copy link
Copy Markdown

ListUsersTest::can_view_default_users_list in the suspend extension has no #[Test] attribute, so
PHPUnit never runs it. It is the only such method in 508 *Test.php files: the repo is fully on
attributes, with 434 files using #[Test] and none using @test.

Adding the attribute alone makes it fail, which is what shows the second problem. Its request is
identical to can_filter_users_by_suspension directly below it:

->withQueryParams([
    'filter' => [
        'suspended' => true,
    ],
])

while it asserts the full user list, [1, 2, 3, 4, 5, 6]. So it filters to suspended users and then
expects every user back, under a name that says default list. The filter block was pasted in by
mistake. Removing it makes the test request the default list its name describes.

Verification

Against mysql:8.4, running the suspend extension's integration suite:

before                      29 tests,  96 assertions
with #[Test] only           30 tests,  98 assertions, 1 failure
with #[Test], no filter     30 tests,  98 assertions

The 3 deprecations are present before and after.

Re-verified against current 2.x before opening this: the method still lacks #[Test], its sibling
still has it, and the filter[suspended] block is still there alongside the full-list assertion.

The method had no #[Test] attribute, so PHPUnit never ran it. It is the only
such method in 508 *Test.php files; the repo is fully on attributes, 434 files
use #[Test] and none use @test.

Adding the attribute alone makes it fail. Its request was identical to
can_filter_users_by_suspension below it, filter[suspended]=true, while asserting
the full user list, so the filter block was pasted in by mistake. Removing it
makes the test request the default list its name describes.

Against mysql:8.4, the suspend extension's integration suite:

  before                      29 tests,  96 assertions
  with #[Test] only           30 tests,  98 assertions, 1 failure
  with #[Test], no filter     30 tests,  98 assertions

The 3 deprecations are present before and after.
@dylanpulver
dylanpulver requested a review from a team as a code owner November 4, 2026 07:08
@imorland

imorland commented Nov 4, 2026

Copy link
Copy Markdown
Member

Note

Automated review for @dylanpulver. Multiple AI models with Flarum-specific knowledge reviewed this pull request for me, and a further agent verified their findings; I haven't read it myself yet. I'll look at this pull request personally as soon as I can.

No findings worth fixing. Claude, Codex, the Claude security reviewer, and my independent pass found no issues in the change.

The added #[Test] enables PHPUnit discovery, and removing the suspension filter makes the request match the existing full-list assertion. The sibling test retains suspension-filter coverage. The pull request merges cleanly into 2.x.

Verified by code inspection; tests were not run independently, so the test results reported in the pull request remain unverified by this review. All three reviewers completed successfully.

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.

2 participants