refactor: Update test case to current (PHP) standards#831
Merged
DannyvdSluijs merged 19 commits intomasterfrom Jun 10, 2025
Merged
refactor: Update test case to current (PHP) standards#831DannyvdSluijs merged 19 commits intomasterfrom
DannyvdSluijs merged 19 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the test cases to update them to current PHP standards and improve type safety and code clarity. Key changes include:
- Replacing instance property access with class constants for test paths.
- Adding strict type hints and updated doc annotations for better maintainability.
- Removing a redundant test case and updating JSON decoding across tests.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Drafts/Draft4Test.php | Removed the $schemaSpec property and updated test properties. |
| tests/Drafts/Draft3Test.php | Updated file path resolution to use a class constant rather than an instance property. |
| tests/Drafts/BaseDraftTestCase.php | Replaced property with a constant and updated type annotations. |
| tests/Constraints/VeryBaseTestCase.php | Refactored schema retrieval methods with improved type hints and file handling. |
| tests/Constraints/ConstTest.php | Updated JSON test schema to use "object" instead of "any". |
| tests/Constraints/BaseTestCase.php | Updated type hints and json_decode calls for better consistency. |
| tests/Constraints/ArraysTest.php | Removed a test case related to array items validation. |
| CHANGELOG.md | Updated changelog reflecting these substantive test improvements. |
Comments suppressed due to low confidence (2)
tests/Drafts/Draft4Test.php:16
- The removal of the $schemaSpec property in Draft4Test may break tests that rely on it (for instance, in BaseTestCase where it is used to set the '$schema' property). Consider reintroducing $schemaSpec or refactoring the tests to remove the dependency on it.
protected $schemaSpec = 'http://json-schema.org/draft-04/schema#';
tests/Constraints/ArraysTest.php:272
- The removal of the 'items: true passes validation' test case may reduce coverage for array item validations; please confirm that its removal was intentional and that all necessary scenarios remain adequately tested.
'items: true passes validation' => [ ... ]
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.
This PR improves the test cases classes and addresses some small fixes of issues which exposed themselves.