You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before migrating to pest, I had @Covers statements in the docblocks above my test methods. I always have them refer to functions, not complete classes. e.g:
This makes sure that when the test hits that create method, only those lines will show up as covered. Even tough that test may hit other methods in that class too. Helping me to show which code i intentionally tested. Pest however, does not seem to support that? I would only be able to use the ->covers method on a test, it, or describe block with class names, or function names, but not class methods?
So, I need something that allows me to do something similar as the @Covers example from above.
Now I migrated to pest, but lost this feature I had when just using phpunit :), Maybe I am missing something, please tell me.
How to Reproduce
N.A
Sample Repository
No response
Pest Version
2.28.1
PHP Version
8.2.11
Operation System
macOS
Notes
No response
The text was updated successfully, but these errors were encountered:
I also ran into this. It should not be too hard to add support for this, using callables:
it('works', function() {
// test here...
})->covers([MyClass::class, 'myMethod']);
Unfortunately, it looks like the this is an upstream limitation. PHPUnit only added CoversMethod support in v11 (and pest is still using v10. Additionally, the Covers attributes in PHPUnit are only supported at class level, not at test level, and it looks like there are no plans to support the latter.
What Happened
Before migrating to pest, I had @Covers statements in the docblocks above my test methods. I always have them refer to functions, not complete classes. e.g:
This makes sure that when the test hits that create method, only those lines will show up as covered. Even tough that test may hit other methods in that class too. Helping me to show which code i intentionally tested. Pest however, does not seem to support that? I would only be able to use the ->covers method on a test, it, or describe block with class names, or function names, but not class methods?
So, I need something that allows me to do something similar as the @Covers example from above.
Now I migrated to pest, but lost this feature I had when just using phpunit :), Maybe I am missing something, please tell me.
How to Reproduce
N.A
Sample Repository
No response
Pest Version
2.28.1
PHP Version
8.2.11
Operation System
macOS
Notes
No response
The text was updated successfully, but these errors were encountered: