Skip to content

[PHPUnit60] Skip unknown class in GetMockBuilderGetMockToCreateMockRector - #860

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-unknown-class-get-mock-builder
Dec 3, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
skip-unknown-class-get-mock-builder

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

getMockBuilder()->getMock() allows mocking classes that cannot be autoloaded, while createMock() throws UnknownTypeException: Class or interface "Employee" does not exist.

Found in PrestaShop unit tests, that mock legacy global classes like Employee, Cart or Context - 24 tests broke after the change.

  • skip when the mocked class does not exist, or the argument is not a resolvable class-string
  • existing fixtures now mock an existing Source class

@TomasVotruba
TomasVotruba merged commit 5e5ba4e into main Dec 3, 2026
15 checks passed
@TomasVotruba
TomasVotruba deleted the skip-unknown-class-get-mock-builder branch December 3, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant