Skip to content

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.
@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.

2 participants