Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #55 +/- ##
============================================
+ Coverage 90.88% 93.21% +2.33%
Complexity 382 382
============================================
Files 6 6
Lines 987 987
============================================
+ Hits 897 920 +23
+ Misses 90 67 -23 🚀 New features to boost your workflow:
|
Property-based tests (tests/PropertyTest.php): 10 randomized invariant checks, 200 iterations each, across the full parseSingle / parseMultiple / parseStream / toArray / Stringable API. No external dependency — uses native PHPUnit + mt_rand with a SEED envvar for deterministic reproduction. 84 total tests / 3,279 total assertions after this change. Invariants tested: 1. parseSingle never throws on arbitrary byte strings. 2. parseMultiple never throws on arbitrary byte strings. 3. Determinism: same input always yields same toArray() output. 4. invalid ⇔ both invalidReason and invalidReasonCode are non-null. 5. Every invalid address has a non-null ValidationSeverity. 6. Stringable: (string) $parsed === simpleAddress when valid, '' when invalid. 7. toArray() matches the legacy parse(…, false) output exactly. 8. Synthesized valid addresses round-trip via parseSingle($parsed->simpleAddress). 9. All four factory presets never crash on arbitrary input. 10. (Bonus) ParseErrorCode enum exhaustive severity mapping is verified. Finding: no bugs or crashes found across 2000+ random inputs including arbitrary byte sequences (NUL, control chars, invalid UTF-8), confirming the parser's robustness to malformed input. CONTRIBUTING.md: Developer guide covering: git clone → composer install, all 7 composer scripts (test, test:coverage, infect, bench, stan, cs:check, cs:fix, ci), adding tests via testspec.yml, code-style rules, PHPStan level 8 expectations, PR conventions, RFC citation requirements, and issue reporting template. ROADMAP updates: - Property-based testing flipped to [x] with implementation details. - CONTRIBUTING.md flipped to [x]. PHPStan baseline regenerated (13 entries, +1 from PropertyTest.php untyped array access).
f003530 to
c059328
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.
Summary
Adds property-based (randomized invariant) testing and a contributor guide. Stacks on top of PR #54 (test-strengthening).
Property-based tests
10 randomized invariants, 200 iterations each, using native PHPUnit +
mt_rand(no external dependency). Deterministic viaSEEDenvvar for failure reproduction.invalid=true⇔ bothinvalidReasonandinvalidReasonCodenon-null(string) $parsed === simpleAddresswhen valid,''when invalidparseSingle(x)->toArray() === parse(x, false)for all xatext@label.tldparses; reparsingsimpleAddressyields the samesimpleAddressFinding: no bugs or crashes across 2000+ random inputs including arbitrary byte sequences (NUL, control chars, invalid UTF-8). The parser is robust to malformed input.
CONTRIBUTING.md
Developer guide covering: dev setup, all 7
composerscripts, adding test cases viatestspec.yml, code-style rules, PHPStan level 8, PR conventions, RFC citation requirements, issue template.Numbers
Test plan
composer cipassesSEED=12345 composer testproduces identical results