chore: Add unit tests for media and settings modules - phase 2#130
Open
sabbir1991 wants to merge 1 commit into
Open
chore: Add unit tests for media and settings modules - phase 2#130sabbir1991 wants to merge 1 commit into
sabbir1991 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
============================================
+ Coverage 12.73% 17.97% +5.24%
Complexity 666 666
============================================
Files 22 22
Lines 2748 2748
============================================
+ Hits 350 494 +144
+ Misses 2398 2254 -144
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Phase 2 PHPUnit coverage for previously untested Media Library, Media Sharing, and Settings module classes without modifying production code.
Changes:
- Adds unit tests for Settings admin rendering/action links/body class handling.
- Adds Media Sharing tests for attachment metadata helpers, UI action filtering, and edit protection.
- Adds Media Library admin tests for sync query filtering and consumer-site action restrictions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/phpunit/Unit/Modules/Settings/AdminTest.php |
Adds Settings admin unit tests. |
tests/phpunit/Unit/Modules/MediaSharing/UserInterfaceTest.php |
Adds media sync column and row-action tests. |
tests/phpunit/Unit/Modules/MediaSharing/MediaProtectionTest.php |
Adds synced attachment capability protection tests. |
tests/phpunit/Unit/Modules/MediaSharing/AttachmentTest.php |
Adds attachment sync metadata helper tests. |
tests/phpunit/Unit/Modules/MediaLibrary/ConsumerAdminTest.php |
Adds consumer admin hook and action filtering tests. |
tests/phpunit/Unit/Modules/MediaLibrary/AdminTest.php |
Adds media library AJAX sync filter query tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds PHPUnit unit tests for Phase 2, covering six previously untested classes across the
MediaLibrary,MediaSharing, andSettingsmodules.Why
Continuing the PHPUnit test coverage initiative started in Phase 1.
Related Issue(s):
How
Six new test files added following established Phase 1 patterns (smoke tests for hooks,
assertSamefor logic methods):Unit/Modules/Settings/AdminTest.phpSettings\AdminUnit/Modules/MediaSharing/AttachmentTest.phpMediaSharing\AttachmentUnit/Modules/MediaLibrary/ConsumerAdminTest.phpMediaLibrary\ConsumerAdminUnit/Modules/MediaSharing/UserInterfaceTest.phpMediaSharing\UserInterfaceUnit/Modules/MediaSharing/MediaProtectionTest.phpMediaSharing\MediaProtectionUnit/Modules/MediaLibrary/AdminTest.phpMediaLibrary\AdminNo source files were modified.
Testing Instructions
npm run wp-env:test startnpm run test:phpChecklist
npm run changeset.