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

Refactor IsCamelCapsTest to use dataproviders #846

Open
jrfnl opened this issue Feb 25, 2025 · 0 comments
Open

Refactor IsCamelCapsTest to use dataproviders #846

jrfnl opened this issue Feb 25, 2025 · 0 comments

Comments

@jrfnl
Copy link
Member

jrfnl commented Feb 25, 2025

The PHP_CodeSniffer\Util\Common::isCamelCaps() method is fully covered by dedicated tests in the IsCamelCapsTest class, however, those tests don't comply with certain best practices:

  • Multiple assertions in each test method.
  • No failure description for assertions when a test contains multiple assertions.
  • Unrelated failing assertion can block other tests from running.

The short of it is that these tests could be improved by being refactored to simple test methods containing a single assertion in combination with data providers with descriptively named data sets.

As part of the refactor, a critical look at whether the test cases included are sufficient wouldn't be a bad thing, as code coverage doesn't tell the whole story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant