Skip to content

Conversation

@rodrigoprimo
Copy link
Collaborator

Description

This PR improves the namespaced names tests for the sniffs that extend the AbstractFunctionRestrictionsSniff class based on what was discussed during the review of #2581 and #2620. The sniffs WordPress.Security.EscapeOutput and WordPress.WP.AlternativeFunctions are not included here as they are addressed separately in #2618 and #2617, respectively.

WP/DiscouragedFunctions: rename test case file

Doing this to be able to move an intentional syntax error test to its own file.

WP/DiscouragedFunctions: move syntax error test to its own file

Tests: non-standard case function call tests for sniffs extending AbstractFunctionRestrictionsSniff

This commit ensures that the tests for all sniffs extending the AbstractFunctionRestrictionsSniff class contain a test with a non-standard case, an unqualified, and a fully qualified function call. In some cases, it was possible to update an existing test, and in other cases, it was necessary to add a new one.

For small test files, new tests were inserted alongside related existing tests (rather than appended at the end) to keep similar test cases grouped. The improved test organization should outweigh the added review complexity due to the need to update line numbers in test expectations.

Two sniffs that extend AbstractFunctionRestrictionsSniff will be addressed separately: WordPress.Security.EscapeOutput and WordPress.WP.AlternativeFunctions.

Tests: add namespace\Sub\ tests for sniffs extending AbstractFunctionRestrictionsSniff

This commit adds namespace\Sub\function_name() test cases to all test files for sniffs extending AbstractFunctionRestrictionsSniff.

Two sniffs that extend AbstractFunctionRestrictionsSniff will be addressed separately: WordPress.Security.EscapeOutput and WordPress.WP.AlternativeFunctions.

Tests: vary function names in namespace tests for sniffs extending AbstractFunctionRestrictionsSniff

As suggested in 2581, for sniffs that check multiple functions, the namespace name tests now use different function names rather than repeatedly testing the same function.

Two sniffs that extend AbstractFunctionRestrictionsSniff will be addressed separately: WordPress.Security.EscapeOutput and WordPress.WP.AlternativeFunctions.

Suggested changelog entry

N/A

Doing this to be able to move an intentional syntax error test to its own file.
…stractFunctionRestrictionsSniff`

This commit ensures that the tests for all sniffs extending the `AbstractFunctionRestrictionsSniff` class contain a test with a non-standard case, an unqualified, and a fully qualified function call. In some cases, it was possible to update an existing test, and in other cases, it was necessary to add a new one.

For small test files, new tests were inserted alongside related existing tests (rather than appended at the end) to keep similar test cases grouped. The improved test organization should outweigh the added review complexity due to the need to update line numbers in test expectations.

Two sniffs that extend `AbstractFunctionRestrictionsSniff` will be addressed separately: `WordPress.Security.EscapeOutput` and `WordPress.WP.AlternativeFunctions`.
…ionRestrictionsSniff`

This commit adds `namespace\Sub\function_name()` test cases to all test files for sniffs extending `AbstractFunctionRestrictionsSniff`.

Two sniffs that extend `AbstractFunctionRestrictionsSniff` will be addressed separately: `WordPress.Security.EscapeOutput` and `WordPress.WP.AlternativeFunctions`.
…bstractFunctionRestrictionsSniff`

As suggested in 2581, for sniffs that check multiple functions, the namespace name tests now use different function names rather than repeatedly testing the same function.

Two sniffs that extend `AbstractFunctionRestrictionsSniff` will be addressed separately: `WordPress.Security.EscapeOutput` and `WordPress.WP.AlternativeFunctions`.
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.

1 participant