Skip to content

Update test stack: migrate to Foundry 2 and PHPUnit 11 (Case 212955) - #25

Merged
janopae merged 1 commit into
masterfrom
212955-foundry-2
Jul 31, 2026
Merged

Update test stack: migrate to Foundry 2 and PHPUnit 11 (Case 212955)#25
janopae merged 1 commit into
masterfrom
212955-foundry-2

Conversation

@janopae

@janopae janopae commented Jul 31, 2026

Copy link
Copy Markdown
Member

Foundry 1 cannot run on Symfony 8, so it must be replaced before the final bump; on the interim Symfony 7 this can happen in isolation. Foundry 2 removed the ModelFactory base class — rewrite the four test factories onto PersistentProxyObjectFactory: getDefaults() → defaults(), getClass() → class() (public static), initialize() return type self → static. Because Foundry 2 requires PHPUnit >= 9.5 (and Foundry 1 does not run on PHPUnit 11), the PHPUnit 8.5 → 11 bump and the phpunit.xml schema update ride along in the same package.

Two additional fixes needed to make the suite green on PHPUnit 11:

  • buildForm() and configureOptions(): add missing : void return type to the five form types that declared them without one (EmailAddressType, HoneypotType, StartRegistration\Type, EditRegistration\Type, DeleteRegistration\Type). mapDataToForms() and mapFormsToData() were already typed correctly; Command::execute(), the FlashBag→RequestStack replacement, and the routing 'attribute' switch were already in place from Package E.
  • DetermineAppsSubclassHelper: skip eval()'d PHPUnit test-double classes when scanning get_declared_classes() for a RecipientInterface subclass. PHPUnit 11 auto-generates named stub classes (via eval()) for interface return types — these were picked up before App\Recipient, causing RecipientFactoryTest to fail in the full suite. PHP reports a synthetic filename for eval()'d code rather than false, so the guard uses is_file() to confirm a real file exists on disk.

Foundry 1 cannot run on Symfony 8, so it must be replaced before the final
bump; on the interim Symfony 7 this can happen in isolation. Foundry 2
removed the ModelFactory base class — rewrite the four test factories onto
PersistentProxyObjectFactory: getDefaults() → defaults(), getClass() →
class() (public static), initialize() return type self → static.
Because Foundry 2 requires PHPUnit >= 9.5 (and Foundry 1 does not run on
PHPUnit 11), the PHPUnit 8.5 → 11 bump and the phpunit.xml schema update
ride along in the same package.

Two additional fixes needed to make the suite green on PHPUnit 11:

- buildForm() and configureOptions(): add missing `: void` return type to
  the five form types that declared them without one (EmailAddressType,
  HoneypotType, StartRegistration\Type, EditRegistration\Type,
  DeleteRegistration\Type). mapDataToForms() and mapFormsToData() were
  already typed correctly; Command::execute(), the FlashBag→RequestStack
  replacement, and the routing 'attribute' switch were already in place
  from Package E.
- DetermineAppsSubclassHelper: skip eval()'d PHPUnit test-double classes
  when scanning get_declared_classes() for a RecipientInterface subclass.
  PHPUnit 11 auto-generates named stub classes (via eval()) for interface
  return types — these were picked up before App\Recipient, causing
  RecipientFactoryTest to fail in the full suite. PHP reports a synthetic
  filename for eval()'d code rather than false, so the guard uses is_file()
  to confirm a real file exists on disk.
@janopae janopae changed the title Update test stack: migrate to Foundry 2 and PHPUnit 11 Update test stack: migrate to Foundry 2 and PHPUnit 11 (Case 212955) Jul 31, 2026
@janopae
janopae merged commit 0fa93c3 into master Jul 31, 2026
3 checks passed
@janopae
janopae deleted the 212955-foundry-2 branch July 31, 2026 07:16
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