Skip to content

Commit

Permalink
Merge pull request #2225 from WordPress/feature/allow-for-coverage-re…
Browse files Browse the repository at this point in the history
…cording

Tests: allow for recording code coverage + add `@covers` tags
  • Loading branch information
dingo-d committed Apr 18, 2023
2 parents 39ecc31 + 6172245 commit de872bb
Show file tree
Hide file tree
Showing 61 changed files with 158 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
vendor
vendor/
composer.lock
build/
phpunit.xml
phpcs.xml
.phpcs.xml
2 changes: 2 additions & 0 deletions WordPress/Tests/Arrays/ArrayDeclarationSpacingUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.11.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\Arrays\ArrayDeclarationSpacingSniff
*/
final class ArrayDeclarationSpacingUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Arrays/ArrayIndentationUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.12.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\Arrays\ArrayIndentationSniff
*/
final class ArrayIndentationUnitTest extends AbstractSniffUnitTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.3.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\Arrays\ArrayKeySpacingRestrictionsSniff
*/
final class ArrayKeySpacingRestrictionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Arrays/CommaAfterArrayItemUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.12.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\Arrays\CommaAfterArrayItemSniff
*/
final class CommaAfterArrayItemUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Arrays/MultipleStatementAlignmentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 0.14.0
*
* @covers \WordPressCS\WordPress\Sniffs\Arrays\MultipleStatementAlignmentSniff
*/
final class MultipleStatementAlignmentUnitTest extends AbstractSniffUnitTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 0.14.0
*
* @covers \WordPressCS\WordPress\Sniffs\CodeAnalysis\AssignmentInTernaryConditionSniff
*/
final class AssignmentInTernaryConditionUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/CodeAnalysis/EscapedNotTranslatedUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 2.2.0
*
* @covers \WordPressCS\WordPress\Sniffs\CodeAnalysis\EscapedNotTranslatedSniff
*/
final class EscapedNotTranslatedUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/DB/DirectDatabaseQueryUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* @since 0.3.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `VIP` category to the `DB` category.
*
* @covers \WordPressCS\WordPress\Helpers\RulesetPropertyHelper
* @covers \WordPressCS\WordPress\Sniffs\DB\DirectDatabaseQuerySniff
*/
final class DirectDatabaseQueryUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 0.14.0
*
* @covers \WordPressCS\WordPress\Sniffs\DB\PreparedSQLPlaceholdersSniff
*/
final class PreparedSQLPlaceholdersUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/DB/PreparedSQLUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* @since 0.8.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `WP` category to the `DB` category.
*
* @covers \WordPressCS\WordPress\Helpers\WPDBTrait
* @covers \WordPressCS\WordPress\Sniffs\DB\PreparedSQLSniff
*/
final class PreparedSQLUnitTest extends AbstractSniffUnitTest {

Expand Down
4 changes: 4 additions & 0 deletions WordPress/Tests/DB/RestrictedClassesUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* @since 0.10.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 3.0.0 Renamed the fixtures to create compatibility with PHPCS 4.x/PHPUnit >=8.
*
* @covers \WordPressCS\WordPress\AbstractClassRestrictionsSniff
* @covers \WordPressCS\WordPress\Helpers\RulesetPropertyHelper
* @covers \WordPressCS\WordPress\Sniffs\DB\RestrictedClassesSniff
*/
final class RestrictedClassesUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/DB/RestrictedFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.10.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\DB\RestrictedFunctionsSniff
*/
final class RestrictedFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/DB/SlowDBQueryUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* @since 0.3.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `VIP` category to the `DB` category.
*
* @covers \WordPressCS\WordPress\AbstractArrayAssignmentRestrictionsSniff
* @covers \WordPressCS\WordPress\Sniffs\DB\SlowDBQuerySniff
*/
final class SlowDBQueryUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/DateTime/CurrentTimeTimestampUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 2.2.0
*
* @covers \WordPressCS\WordPress\Sniffs\DateTime\CurrentTimeTimestampSniff
*/
final class CurrentTimeTimestampUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/DateTime/RestrictedFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 2.2.0
*
* @covers \WordPressCS\WordPress\Sniffs\DateTime\RestrictedFunctionsSniff
*/
final class RestrictedFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Files/FileNameUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @since 2013-06-11
* @since 0.11.0 Actually added tests ;-)
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\Files\FileNameSniff
*/
final class FileNameUnitTest extends AbstractSniffUnitTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*
* @since 0.12.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Helpers\IsUnitTestTrait
* @covers \WordPressCS\WordPress\Sniffs\NamingConventions\PrefixAllGlobalsSniff
*/
final class PrefixAllGlobalsUnitTest extends AbstractSniffUnitTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*
* @since 2013-06-11
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Helpers\DeprecationHelper
* @covers \WordPressCS\WordPress\Sniffs\NamingConventions\ValidFunctionNameSniff
*/
final class ValidFunctionNameUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/NamingConventions/ValidHookNameUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*
* @since 0.10.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Helpers\WPHookHelper
* @covers \WordPressCS\WordPress\Sniffs\NamingConventions\ValidHookNameSniff
*/
final class ValidHookNameUnitTest extends AbstractSniffUnitTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 2.2.0
*
* @covers \WordPressCS\WordPress\Sniffs\NamingConventions\ValidPostTypeSlugSniff
*/
final class ValidPostTypeSlugUnitTest extends AbstractSniffUnitTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*
* @since 0.9.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Helpers\SnakeCaseHelper
* @covers \WordPressCS\WordPress\Sniffs\NamingConventions\ValidVariableNameSniff
*/
final class ValidVariableNameUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/DevelopmentFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.11.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\DevelopmentFunctionsSniff
*/
final class DevelopmentFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/DiscouragedPHPFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.11.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\DiscouragedPHPFunctionsSniff
*/
final class DiscouragedPHPFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/DontExtractUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @since 0.10.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `Functions` category to the `PHP` category.
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\DontExtractSniff
*/
final class DontExtractUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/IniSetUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 2.1.0
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\IniSetSniff
*/
final class IniSetUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/NoSilencedErrorsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 1.1.0
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\NoSilencedErrorsSniff
*/
final class NoSilencedErrorsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/POSIXFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.10.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\POSIXFunctionsSniff
*/
final class POSIXFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/PregQuoteDelimiterUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 1.0.0
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\PregQuoteDelimiterSniff
*/
final class PregQuoteDelimiterUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/RestrictedPHPFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 0.14.0
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\RestrictedPHPFunctionsSniff
*/
final class RestrictedPHPFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/PHP/StrictInArrayUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*
* @since 0.9.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\AbstractFunctionParameterSniff
* @covers \WordPressCS\WordPress\Sniffs\PHP\StrictInArraySniff
*/
final class StrictInArrayUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/TypeCastsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 1.2.0
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\TypeCastsSniff
*/
final class TypeCastsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/PHP/YodaConditionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.3.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\PHP\YodaConditionsSniff
*/
final class YodaConditionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Security/EscapeOutputUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @since 2013-06-11
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `XSS` category to the `Security` category.
*
* @covers \WordPressCS\WordPress\Sniffs\Security\EscapeOutputSniff
*/
final class EscapeOutputUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Security/NonceVerificationUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @since 0.5.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `CSRF` category to the `Security` category.
*
* @covers \WordPressCS\WordPress\Sniffs\Security\NonceVerificationSniff
*/
final class NonceVerificationUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Security/PluginMenuSlugUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @since 0.3.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `VIP` category to the `Security` category.
*
* @covers \WordPressCS\WordPress\Sniffs\Security\PluginMenuSlugSniff
*/
final class PluginMenuSlugUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Security/SafeRedirectUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 1.0.0
*
* @covers \WordPressCS\WordPress\Sniffs\Security\SafeRedirectSniff
*/
final class SafeRedirectUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/Security/ValidatedSanitizedInputUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* @since 0.3.0
* @since 0.13.0 Class name changed: this class is now namespaced.
* @since 1.0.0 This sniff has been moved from the `VIP` category to the `Security` category.
*
* @covers \WordPressCS\WordPress\Helpers\VariableHelper
* @covers \WordPressCS\WordPress\Sniffs\Security\ValidatedSanitizedInputSniff
*/
final class ValidatedSanitizedInputUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/Utils/I18nTextDomainFixerUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 1.2.0
*
* @covers \WordPressCS\WordPress\Sniffs\Utils\I18nTextDomainFixerSniff
*/
final class I18nTextDomainFixerUnitTest extends AbstractSniffUnitTest {

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Tests/WP/AlternativeFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*
* @since 0.11.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Helpers\MinimumWPVersionTrait
* @covers \WordPressCS\WordPress\Sniffs\WP\AlternativeFunctionsSniff
*/
final class AlternativeFunctionsUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/WP/CapabilitiesUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*
* @package WPCS\WordPressCodingStandards
* @since 3.0.0
*
* @covers \WordPressCS\WordPress\Sniffs\WP\CapabilitiesSniff
*/
final class CapabilitiesUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/WP/CapitalPDangitUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*
* @since 0.12.0
* @since 0.13.0 Class name changed: this class is now namespaced.
*
* @covers \WordPressCS\WordPress\Sniffs\WP\CapitalPDangitSniff
*/
final class CapitalPDangitUnitTest extends AbstractSniffUnitTest {

Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/WP/ClassNameCaseUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* @package WPCS\WordPressCodingStandards
*
* @since 3.0.0
*
* @covers \WordPressCS\WordPress\Sniffs\WP\ClassNameCaseSniff
*/
final class ClassNameCaseUnitTest extends AbstractSniffUnitTest {

Expand Down
Loading

0 comments on commit de872bb

Please sign in to comment.