-
Notifications
You must be signed in to change notification settings - Fork 144
Add trait
for 'standard' Commentable
implementation
#813
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
Comments
When we implement the trait, we don't need to add it to the |
Presumably we would have a dedicated |
Yes, that's the way to go. (We'll need to check whether we can I also found this article (which is a bit on the older side, though): https://doeken.org/blog/testing-traits-in-phpunit |
Two more thoughts on this:
|
Do you mean "... fan of adding traits only if there ..."?
The first technique has the drawbacks mentioned. The second technique uses an anonymous class, and would work, though the article says:
The final three techniques all use PHPUnit methods which have been deprecated since v10.1, and for which there are no alternatives. From sebastianbergmann/phpunit#5244:
I don't see (or smell) the 'smell' here. Anyway, it looks like the only options are an anonymous class defined in |
This can implement |
Oh, yes, of course. Thanks for noticing and asking! |
I'd be fine with either Edit: And I'd prefer a "real" fixture class over an anonymous class. |
This would also be consistent style-wise with the classes in |
The various classes that implement
Commentable
all seem to have exactly the same implementation.This duplication could be avoided by using a
trait
for a 'standard' implementation.The text was updated successfully, but these errors were encountered: