Ssl: improve tests - #551
Merged
Merged
Conversation
... grouping tests using the same data provider together, with the data provider they are using directly below it.
* Add docblock documentation to the tests and the data provider. * Use same parameter names in the test method, as used in the functions under test. * Rename the data provider method to match the test name(s) it applies to. * Remove `static` keyword from data provider. * Used named datasets and keyed data entries in the data provider
* Add docblock documentation to the tests and the data provider. * Use same parameter names in the test method, as used in the functions under test. * Rename the data provider method to match the test name(s) it applies to. * Remove `static` keyword from data provider. * Used named datasets and keyed data entries in the data provider
... to cover a previously uncovered code path and safeguard against regressions.
Merge two additional tests into the base test methods. As these additional methods are specific to the `verify_certificate()` method and do not apply to the `match_domain()` method, they are placed in separate data providers (yes, you can have multiple data providers for one test), but having them in a data provider allows for more easily adding more additional test cases at a later point in time. I'm leaving the `SslTest::testIgnoreCNWithSAN()` test method in place as that's testing something very specific and the test method documentation explains that case well.
... to allow for testing more edge cases.
…tificate()` ... to cover a previously uncovered code path and safeguard against regressions.
No need to check whether `$cert['extensions']` is empty if we're going to check if `$cert['extensions']['subjectAltName']` is empty anyway. See: https://3v4l.org/Z1hgQ
... to reduce the number of possible paths which can be taken through the function / lower complexity.
schlessera
approved these changes
Sep 23, 2021
16 tasks
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.
SslTest: rearrange the method order in the test class
... grouping tests using the same data provider together, with the data provider they are using directly below it.
SslTest: improve "match" tests
statickeyword from data provider.SslTest: improve "no-match" tests
statickeyword from data provider.SslTest: add extra "no-match" test cases
... to cover a previously uncovered code path and safeguard against regressions.
SslTest: refactor additional verify_certificate() tests
Merge two additional tests into the base test methods.
As these additional methods are specific to the
verify_certificate()method and do not apply to thematch_domain()method, they are placed in separate data providers (yes, you can have multiple data providers for one test), but having them in a data provider allows for more easily adding more additional test cases at a later point in time.I'm leaving the
SslTest::testIgnoreCNWithSAN()test method in place as that's testing something very specific and the test method documentation explains that case well.SslTest::fakeCertificate(): make test helper a little more flexible
... to allow for testing more edge cases.
SslTest: add extra "no-match" test cases specifically for
verify_certificate()... to cover a previously uncovered code path and safeguard against regressions.
Ssl::verify_certificate(): remove unnecessary condition
No need to check whether
$cert['extensions']is empty if we're going to check if$cert['extensions']['subjectAltName']is empty anyway.See: https://3v4l.org/Z1hgQ
Ssl::verify_certificate(): minor code tweaks
... to reduce the number of possible paths which can be taken through the function / lower complexity.
SslTest: add docblock to helper function
SslTest: add @Covers tags
Related to #497