Add meaningful test coverage for getNamespacedClasses and getInstantiatedClasses - #88
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add remaining test coverage for methods
Add meaningful test coverage for Mar 15, 2026
getNamespacedClasses and getInstantiatedClasses
tehwave
marked this pull request as ready for review
March 15, 2026 14:10
There was a problem hiding this comment.
Pull request overview
This PR strengthens the unit tests around Shortcode::getNamespacedClasses() and Shortcode::getInstantiatedClasses() so they validate actual transformation/instantiation behavior rather than only asserting return types.
Changes:
- Updates
test_get_namespaced_classes()to generate a real shortcode class and assert the expected namespaced class string is returned. - Updates
test_get_instantiated_classes()to generate and load a shortcode class, then assert the returned collection containsShortcodeinstances. - Adjusts
composer.jsonPHPUnit dev dependency constraint.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/ShortcodeTest.php | Adds more meaningful assertions by generating shortcodes on disk and validating results. |
| composer.json | Changes PHPUnit dev version constraint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| "laravel/pint": "^1.21", | ||
| "orchestra/testbench": "^9.0|^10.0", | ||
| "phpunit/phpunit": "^10.5|^11.5.3" | ||
| "phpunit/phpunit": "^11.5" |
Comment on lines
+207
to
+209
| $this->artisan('make:shortcode', ['name' => $name])->assertExitCode(0); | ||
|
|
||
| try { |
Comment on lines
+219
to
+222
| } finally { | ||
| unlink($path); | ||
|
|
||
| Shortcode::clearCache(); |
Comment on lines
+234
to
+239
| $this->artisan('make:shortcode', ['name' => $name])->assertExitCode(0); | ||
|
|
||
| require_once $path; | ||
|
|
||
| try { | ||
| Shortcode::clearCache(); |
Owner
|
@copilot apply changes based on the comments in this thread also rebase to fix tests. |
Contributor
Author
Done in b463a15. Addressed all the review feedback:
|
Co-authored-by: tehwave <4569897+tehwave@users.noreply.github.com>
…atedClasses Co-authored-by: tehwave <4569897+tehwave@users.noreply.github.com>
… composer constraint Co-authored-by: tehwave <4569897+tehwave@users.noreply.github.com>
tehwave
force-pushed
the
copilot/add-remaining-test-coverage
branch
from
March 15, 2026 15:47
b463a15 to
784d32b
Compare
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.
test_get_namespaced_classes()to verify namespace transformationtest_get_instantiated_classes()to verify each returned item is aShortcodeinstanceartisan()andrequire_onceinsidetryblocks so cleanup is always guaranteedunlink()withfile_exists()to prevent warnings if file was never createdcomposer.jsonPHPUnit constraint to^10.5|^11.5.3for CI matrix compatibilityOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.