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(): throw exception when method called without tokenized test case file #385

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 23, 2022

Follow up on #382 which made the UtilityMethodTestCase::getTargetToken() method static.

As the method could conceivably now be called before the UtilityMethodTestCase::setUpTestFile(), let's throw an exception with an informative error message if that's the case.

Includes:

  • A new PHPCSUtils\Exceptions\TestFileNotFound exception class.
  • Tests for both the new exception as well as the implementation of that exception in the UtilityMethodTestCase::getTargetToken() method.

…called without tokenized test case file

Follow up on 382 which made the method `static`.

As the method _could_ conceivably now be called _before_ the `UtilityMethodTestCase::setUpTestFile()`, let's throw an exception with an informative error message if that's the case.

Includes:
* A new `PHPCSUtils\Exceptions\TestFileNotFound` exception class.
* Tests for both the new exception as well as the implementation of that exception in the `UtilityMethodTestCase::getTargetToken()` method.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Oct 23, 2022
@jrfnl jrfnl merged commit f8e2110 into develop Oct 23, 2022
@jrfnl jrfnl deleted the testutils/utilitymethodtestcase-gettargettoken-stabilize branch October 23, 2022 06:56
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