Skip to content

UtilityMethodTestCase: fail test on missing test marker comment#273

Merged
jrfnl merged 1 commit into
developfrom
utilitymethodtestcase/gettargetmethod-fail-on-missing-test-comment
May 29, 2021
Merged

UtilityMethodTestCase: fail test on missing test marker comment#273
jrfnl merged 1 commit into
developfrom
utilitymethodtestcase/gettargetmethod-fail-on-missing-test-comment

Conversation

@jrfnl

@jrfnl jrfnl commented May 29, 2021

Copy link
Copy Markdown
Member

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.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone May 29, 2021
@jrfnl jrfnl merged commit 5965735 into develop May 29, 2021
@jrfnl jrfnl deleted the utilitymethodtestcase/gettargetmethod-fail-on-missing-test-comment branch May 29, 2021 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant