Unskip official test + various test suite enhancements #191
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.
Hi,
The main goal of this PR is to unskip the zero terminated floats test from the official suite.
It turns out that the issue doesn't come from the validator itself, but from the way test cases are loaded, i.e. using a
json_encode
extra step (here) which casts zero terminated floats to integers. The encoding optionJSON_PRESERVE_ZERO_FRACTION
could help, but it's only available as of PHP 5.6.6.So... long story short, I took the liberty to refactor the test suite in order to address this issue, and while I was at it, to make improvements where I could in the testing setup. Here are the results:
Tests\Constraints
which previously used PHP strings to store JSON data are now based entirely on independent JSON files, containing the data needed to execute them, just like in the official JSON Schema suite.ValidatorTestCase
, provides the main test method as well as helpers for all the tests based on JSON files (i.e. both constraint and draft tests).getSkippedTests
method is replaced by a whitelist/blacklist functionality, allowing to quickly include/exclude tests during development.