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

UtilityMethodTestCase::getTargetToken(): change to a static method #382

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 23, 2022

The method effectively was already static as it didn't use $this. Making it explicitly static will allow for using it in "set up before class" test fixture methods.

This is particularly useful when a "cache" of information would need to be set up using the same code as the code under test. If this is done in a "set up" fixture, the code being run would be counted for the code coverage calculation, while when don in "set up before class", the code being run will not be counted for code coverage, allowing for cleaner coverage reports.

Includes introducing some minor variations in the pre-existing tests to safeguard that both static calls as well as non-static calls to the method are supported.

The method effectively was already `static` as it didn't use `$this`. Making it explicitly static will allow for using it in "set up before class" test fixture methods.

This is particularly useful when a "cache" of information would need to be set up using the same code as the code under test.
If this is done in a "set up" fixture, the code being run would be counted for the code coverage calculation, while when don in "set up before class", the code being run will _not_ be counted for code coverage, allowing for cleaner coverage reports.

Includes introducing some minor variations in the pre-existing tests to safeguard that both static calls as well as non-static calls to the method are supported.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Oct 23, 2022
@jrfnl jrfnl merged commit 3f75cc5 into develop Oct 23, 2022
@jrfnl jrfnl deleted the testutils/utilitymethodtestcase-make-gettargettoken-method-static branch October 23, 2022 03:36
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.

None yet

1 participant