Skip to content

[Chore]: Add NoAssertSeeRule to flag assertSee assertions in tests - #149

Merged
danharrin merged 1 commit into
mainfrom
chore/ban-assert-see
Aug 24, 2026
Merged

[Chore]: Add NoAssertSeeRule to flag assertSee assertions in tests#149
danharrin merged 1 commit into
mainfrom
chore/ban-assert-see

Conversation

@Orrison

@Orrison Orrison commented Aug 23, 2026

Copy link
Copy Markdown
Member

Ticket(s) or GitHub Issue

  • N/A

Technical Description

Adds a custom PHPStan rule banning the usage of testing assertSee type methods.

Any deployment steps required?

No

Are any Feature Flags and/or Data Migrations that can eventually be removed Added?

No


Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.

@Orrison
Orrison requested a review from danharrin August 23, 2026 20:32
@Orrison
Orrison requested a review from a team as a code owner August 23, 2026 20:32
@canyon-gbs-automation
canyon-gbs-automation Bot requested a lite review from Copilot August 23, 2026 20:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new custom PHPStan rule to discourage brittle “assertSee”-style assertions in tests by flagging calls to the assertSee* / assertDontSee* family on known testing receivers, along with focused PHPStan-rule tests and fixtures to validate correct detection, exclusions, and inline-ignoring behavior.

Changes:

  • Introduces CanyonGBS\Common\Rules\NoAssertSee\NoAssertSeeRule and registers it in phpstan-extension.neon.
  • Adds a dedicated PHPStan config plus Pest-based rule tests that execute PHPStan against fixtures.
  • Adds fixtures that exercise banned assertions, allowed lookalikes, and identifier-based inline ignores.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/PHPStan/NoAssertSeeTest.php Adds Pest coverage that runs PHPStan against fixtures and validates rule triggering/ignoring.
tests/PHPStan/Fixtures/AssertSeeFixture.php Fixture containing a representative set of banned assertSee*/assertDontSee* calls.
tests/PHPStan/Fixtures/AssertSeeAllowedFixture.php Fixture ensuring same-named methods on unrelated classes (and other assertions) are not flagged.
tests/PHPStan/Fixtures/AssertSeeIgnoredFixture.php Fixture ensuring identifier-based inline ignore suppresses the rule as intended.
tests/PHPStan/Configs/no-assert-see.neon Minimal PHPStan config to run the rule against fixtures in isolation.
src/Rules/NoAssertSee/NoAssertSeeRule.php Implements the new PHPStan rule and its receiver/type filtering + identifier.
phpstan-extension.neon Registers the new rule in the package’s PHPStan extension services.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@danharrin
danharrin changed the base branch from main to chore/invokable-actions-rule August 24, 2026 14:17
@danharrin
danharrin force-pushed the chore/ban-assert-see branch from 5024a5c to 7fa5806 Compare August 24, 2026 14:17
Base automatically changed from chore/invokable-actions-rule to main August 24, 2026 14:18
Signed-off-by: Kevin Ullyott <kevin.ullyott@canyongbs.com>
@danharrin
danharrin force-pushed the chore/ban-assert-see branch from 7fa5806 to a07344f Compare August 24, 2026 14:18
@danharrin
danharrin merged commit 9684539 into main Aug 24, 2026
8 of 9 checks passed
@danharrin
danharrin deleted the chore/ban-assert-see branch August 24, 2026 14:28
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.

3 participants