Skip to content

refactor: Update test case to current (PHP) standards #831

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

Merged
merged 19 commits into from
Jun 10, 2025

Conversation

DannyvdSluijs
Copy link
Collaborator

This PR improves the test cases classes and addresses some small fixes of issues which exposed themselves.

@DannyvdSluijs DannyvdSluijs changed the title Draft test case refactor refactor: Update test case to current standards Jun 6, 2025
@DannyvdSluijs DannyvdSluijs changed the title refactor: Update test case to current standards refactor: Update test case to current (PHP) standards Jun 10, 2025
@DannyvdSluijs DannyvdSluijs requested a review from Copilot June 10, 2025 18:38
Copy link
Contributor

@Copilot Copilot AI left a 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 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' => [ ... ]

@DannyvdSluijs DannyvdSluijs merged commit 0b25270 into master Jun 10, 2025
16 checks passed
@DannyvdSluijs DannyvdSluijs deleted the draft-test-case-refactor branch June 10, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant