Skip to content

fix(rector): convert parent:: skip and expectation calls instead of dropping them - #426

Open
roxblnfk wants to merge 1 commit into
1.xfrom
fix/rector-parent-calls
Open

roxblnfk wants to merge 1 commit into
1.xfrom
fix/rector-parent-calls

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

🔍 What was changed

  • ExtendsTestCaseToTestoRector drops only parent:: calls to TestCase hooks (setUp(), tearDown(), assertPostConditions() and the like). Other parent:: calls into PHPUnit become self:: (static) or $this->, so parent::markTestSkipped() turns into #[Skip] and parent::expectException() into Expect::exception() under the full set.
  • A call without a Testo mapping, such as parent::addToAssertionCount(), now stays visible as $this->addToAssertionCount() instead of disappearing.
  • A parent::X() inside the class's own override of X is dropped, since $this->X() there would recurse.
  • An anonymous class extending TestCase now gets its parent:: calls handled too; its ancestry is read from the base it names.

Checklist

Documentation

FEATURE_PARITY.md, PhpunitToTesto/TODO.md and the testo-migrate-from-phpunit skill describe the new behaviour.

… dropping them

fix(rector): rewrite `parent::` calls in an anonymous class detached from `TestCase`

Only `TestCase` hook calls carry nothing once the class is detached; dropping the rest silently changed what a test checks. The other `parent::` calls into PHPUnit now take the `self::`/`$this->` spelling the skip and expectation rules already convert, and an anonymous class reads its ancestry from the base it names.

Fixes #410
Fixes #411

Assisted-By: Claude Opus 5.5
@roxblnfk
roxblnfk requested a review from a team as a code owner November 18, 2026 09:37
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant