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: fail test on missing test marker comment #273

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented May 29, 2021

When a test marker comment was not found, the UtilityMethodTestCase::getTargetToken() would search for the target token between the start of the file and the first test marker it did find.

This could lead to the wrong token being set as the $stackPtr for a test.

This improves the UtilityMethodTestCase::getTargetToken() method by failing the test when the test marker comment cannot be found.

The $failTest parameter to throw an exception instead of failing the test is not taken into account as when the test marker comment cannot be found, the correct test target can never be found, no matter what token types or content is passed.

Includes unit test.

When a test marker comment was not found, the `UtilityMethodTestCase::getTargetToken()` would search for the target token between the start of the file and the first test marker it _did_ find.

This could lead to the wrong token being set as the `$stackPtr` for a test.

This improves the `UtilityMethodTestCase::getTargetToken()` method by failing the test when the test marker comment cannot be found.

The `$failTest` parameter to throw an exception instead of failing the test is not taken into account as when the test marker comment cannot be found, the correct test target can never be found, no matter what token types or content is passed.

Includes unit test.
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