fix: Resolve 2.2 review issues#120
Merged
Merged
Conversation
…n tests, fix comment
- Issue 1 (Major): Refactor harvestFlacTags() to extract STREAMINFO
duration in the same file pass instead of reopening via getFlacDuration()
- Issue 2 (Major): Add direct unit tests for getFlacDuration() using
reflection - valid FLAC, invalid sample rate, zero total samples,
STREAMINFO not first block
- Issue 3 (Minor): Fix misleading comment - byte 7 uses 'lower'
not 'upper' 4 bits for total_samples[32:35]
- Issue 4 (Minor): Confirm zero-samples test already has
assertArrayNotHasKey('duration_secs')
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Fixes issues found in the 2.2 review:
Issue 1 (Major): Double file open
Refactored
harvestFlacTags()to extract STREAMINFO duration in the same file pass instead of reopening viagetFlacDuration(). Added helper methodparseFlacDurationFromData()to support this.Issue 2 (Major): Missing direct unit tests for getFlacDuration()
Added direct unit tests for
getFlacDuration()using reflection:testGetFlacDurationWithValidFlacReturnsInttestGetFlacDurationWithInvalidSampleRateReturnsNulltestGetFlacDurationWithZeroTotalSamplesReturnsNulltestGetFlacDurationWithStreaminfoNotFirstBlockReturnsNullIssue 3 (Minor): Fix misleading comment
Changed "upper 4 bits" to "lower 4 bits" in byte 7 comment for
total_samples[32:35].Issue 4 (Minor): Strengthen zero-samples test
Verified
testHarvestTagsFlacWithZeroTotalSamplesReturnsNoDurationalready hasassertArrayNotHasKey('duration_secs', $tags).Testing
All 16 AudioScanner tests pass:
PHPStan level 9 passes (only unused method warning for
getFlacDurationwhich is tested via reflection). PHPCS PSR-12 passes.