Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File::getMemberProperties(): improve tests #221

Merged
merged 4 commits into from
Jan 2, 2024

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 2, 2024

Description

Tests/GetMemberPropertiesTest: minor tweak

... to improve the descriptiveness of one test.

Tests/GetMemberPropertiesTest: use named data sets

With non-named data sets, when a test fails, PHPUnit will display the number of the test which failed.

With tests which have a lot of data sets, this makes it interesting (and time-consuming) to debug those, as one now has to figure out which of the data sets in the data provider corresponds to that number.

Using named data sets makes debugging failing tests more straight forward as PHPUnit will display the data set name instead of the number.
Using named data sets also documents what exactly each data set is testing.

Aside from adding the data set name, this commit also adds the parameter name for each item in the data set, this time in an effort to make it more straight forward to update and add tests as it will be more obvious what each key in the data set signifies.

Includes fixing the data types in the docblocks and making them more specific, where relevant.

Tests/GetMemberPropertiesTest: more thoroughly test existing tests

This adds testing of the type_token and type_end_token return value indexes to the pre-existing tests, same as was already being tested in PHPCSUtils.

Tests/GetMemberPropertiesTest: add extra tests

This adds some extra tests which were already in use in PHPCSUtils.

Suggested changelog entry

N/A

Related issues/external references

Related to #146

... to improve the descriptiveness of one test.
With non-named data sets, when a test fails, PHPUnit will display the number of the test which failed.

With tests which have a _lot_ of data sets, this makes it _interesting_ (and time-consuming) to debug those, as one now has to figure out which of the data sets in the data provider corresponds to that number.

Using named data sets makes debugging failing tests more straight forward as PHPUnit will display the data set name instead of the number.
Using named data sets also documents what exactly each data set is testing.

Aside from adding the data set name, this commit also adds the parameter name for each item in the data set, this time in an effort to make it more straight forward to update and add tests as it will be more obvious what each key in the data set signifies.

Includes fixing the data types in the docblocks and making them more specific, where relevant.
This adds testing of the `type_token` and `type_end_token` return value indexes to the pre-existing tests, same as was already being tested in PHPCSUtils.
This adds some extra tests which were already in use in PHPCSUtils.
@jrfnl jrfnl added this to the 3.x Next milestone Jan 2, 2024
@jrfnl jrfnl merged commit 3179ad7 into master Jan 2, 2024
46 checks passed
@jrfnl jrfnl deleted the feature/file-getmemberproperties-improve-tests branch January 2, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant