-
Notifications
You must be signed in to change notification settings - Fork 17
Detect the use of Attributes for PHPUnit Sniffs #207
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #207 +/- ##
============================================
+ Coverage 98.30% 98.37% +0.07%
- Complexity 968 1000 +32
============================================
Files 41 42 +1
Lines 3006 3140 +134
============================================
+ Hits 2955 3089 +134
Misses 51 51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ea1cd85 to
b45d6fc
Compare
064349d to
52c002b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements support for detecting PHP 8.0+ attributes in PHPUnit test case sniffs, specifically adding support for #[DataProvider] and other PHPUnit attributes alongside existing phpdoc-based annotations.
- Adds a new
NamespaceScopeUtilhelper class to properly qualify class names considering imports and namespaces - Extends PHPUnit sniffs to support both traditional phpdoc comments and modern PHP attributes
- Creates a shared
AbstractTestCaseSniffbase class to consolidate common functionality
Reviewed Changes
Copilot reviewed 14 out of 39 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| moodle/Util/NamespaceScopeUtil.php | New utility class for qualifying class names within namespace scope |
| moodle/Util/Attributes.php | Enhanced with qualified name support and new helper methods |
| moodle/Tests/Util/NamespaceScopeUtilTest.php | Test coverage for the new namespace utility |
| moodle/Tests/Util/AttributesTest.php | Updated tests for enhanced attribute functionality |
| moodle/Tests/Sniffs/PHPUnit/fixtures/Provider/attributes_test.php | Test fixture for attribute-based data providers |
| moodle/Tests/Sniffs/PHPUnit/fixtures/Covers/testcasecovers_method_attribute.php | Test fixture for method-level coverage attributes |
| moodle/Tests/Sniffs/PHPUnit/fixtures/Covers/testcasecovers_attribute.php | Test fixture for class-level coverage attributes |
| moodle/Tests/Sniffs/PHPUnit/fixtures/Covers/testcasecovers_abstract.php | Test fixture for abstract test classes |
| moodle/Tests/Sniffs/PHPUnit/TestCaseProviderTest.php | Updated test with attribute support cases |
| moodle/Tests/Sniffs/PHPUnit/TestCaseCoversTest.php | Updated test with attribute support cases |
| moodle/Sniffs/PHPUnit/TestCaseProviderSniff.php | Enhanced to detect and validate DataProvider attributes |
| moodle/Sniffs/PHPUnit/TestCaseCoversSniff.php | Enhanced to detect and validate coverage attributes |
| moodle/Sniffs/PHPUnit/AbstractTestCaseSniff.php | New base class for PHPUnit sniffs with shared functionality |
| CHANGELOG.md | Documentation of the changes |
a29418a to
cedfd35
Compare
cedfd35 to
40a9ebf
Compare
Fixes #205
Blocked by #206 and #207