Repository navigation
Conversation
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.
Part of #1497 (WebControls: input and forms), third of three coverage PRs. Stacked on #1631, which adds
TAssetManagerMockTrait; review the last four commits.Covers
TCaptcha,TReCaptcha2,TReCaptcha2Validator,TProofOfWork,TFormGuard,TPasswordStrengthMeter,TUnsavedChangesGuard,TSuggestionList,TOutputCache,TOutputCacheCalculateKeyEventParameter,TOutputCacheCheckDependencyEventParameter, andTOutputCacheTextWriterMulti.TReCaptchaandTReCaptchaValidatorare removed in #1629 and are not covered.Every line and branch of these files is covered. Each missed path in a method with 16 or fewer paths is impossible: it follows an operand that short-circuited, skips the first fetch of a
foreach, or needs a single pass of a loop over a fixed-length list.TCaptcha::checkRequirements()returns false only without gd and TrueType support; a test subclass reaches the exception it causes.TCaptcha::onPreRender()callsstatic::checkRequirements(), so a subclass can override the check. The random-key fallback ofgenerateRandomKey()is@codeCoverageIgnore, as in #1548:random_bytes()throws only without a system source of randomness.TAssetManagerMockTrait::mockAssetManager()takes the published base, so thecaptcha_key.phptest writes to a temporary folder.Fixes, one commit each with its regression test:
TReCaptcha2ValidatorthrowsTConfigurationException(recaptcha2validator_control_invalid) whenControlToValidatenames a control that is not a TReCaptcha2. It threw\Exceptionwith inline text. The null check is removed, sincegetValidationTarget()already throws for a missing control.TReCaptcha2renders notabindexon its widget container.TabIndexis the widget's own option (default 0), and since TWebControl renders a tab index of 0, the empty container was a tab stop.TOutputCachereads a cached entry without its cache time, assetCacheTime($data[3] ?? 0)already allowed. The destructuring threwTPhpErrorException.Checks: the full unit suite passes on PHP 8.2, and these test classes pass on 8.3, 8.4, and 8.5; php-cs-fixer and PHPStan are clean.