-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot mock readonly class #1317
Comments
Hey @Gyalomalom, Thanks for reporting this issue. I wanted to give some updates, but I don't have the full resolution yet. Working on a fix for this in #1319 but it is not that simple (and may not be possible because of I really appreciate your patience as we work through this issue together, thank you. |
Hello @ghostwriter . Thank you for the update, I will keep an eye on this issue. |
Hey... any update here? |
Mockery Version
1.5.1
PHP Version
PHP 8.2
Issue Description
After upgrading to PHP 8.2 and making a number of classes readonly, our tests began failing. We use a lot of dependency injection so in those cases we need to mock the injected classes. I get the following error:
If I remove readonly from the class and instead make the properties readonly, it works, so currently we are using this approach as a workaround, but I would like to know if Mockery is planning to add support to readonly classes in the future.
Steps to Reproduce
Create a mock of a readonly class using Mockery.
Expected Behavior
The mock is successfully created.
Actual Behavior
An exception is thrown.
Exception or Error
Additional Information
No response
The text was updated successfully, but these errors were encountered: