From 42ce8a2a6ace5c6793647a4d714b69038cfb2470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=BDoljom?= Date: Thu, 9 May 2019 12:21:28 +0200 Subject: [PATCH] Fix the tests and sniff Remove the folder from the sniff, and update tests. --- .../Sniffs/CoreFunctionality/PrefixAllGlobalsSniff.php | 6 +----- .../Tests/CoreFunctionality/PrefixAllGlobalsUnitTest.php | 2 +- .../ThemeTemplatesException/attachment.inc | 3 ++- .../ThemeTemplatesException/footer_widgets.inc | 2 ++ .../CoreFunctionality/ThemeTemplatesException/header.inc | 2 ++ .../ThemeTemplatesException/partials/post-edit.inc | 2 ++ .../ThemeTemplatesException/social-share.inc | 2 ++ 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/WPThemeReview/Sniffs/CoreFunctionality/PrefixAllGlobalsSniff.php b/WPThemeReview/Sniffs/CoreFunctionality/PrefixAllGlobalsSniff.php index 92f90ff6..0bafd0ac 100644 --- a/WPThemeReview/Sniffs/CoreFunctionality/PrefixAllGlobalsSniff.php +++ b/WPThemeReview/Sniffs/CoreFunctionality/PrefixAllGlobalsSniff.php @@ -34,11 +34,7 @@ class PrefixAllGlobalsSniff extends WPCSPrefixAllGlobalsSniff { * * @var array */ - public $allowed_folders = [ - 'template-parts', - 'templates', - 'partials', - ]; + public $allowed_folders = []; /** * Check that defined global variables are prefixed. diff --git a/WPThemeReview/Tests/CoreFunctionality/PrefixAllGlobalsUnitTest.php b/WPThemeReview/Tests/CoreFunctionality/PrefixAllGlobalsUnitTest.php index fd37c5f0..89eb222c 100644 --- a/WPThemeReview/Tests/CoreFunctionality/PrefixAllGlobalsUnitTest.php +++ b/WPThemeReview/Tests/CoreFunctionality/PrefixAllGlobalsUnitTest.php @@ -52,7 +52,7 @@ public function getErrorList( $testFile = 'partials/post-edit.inc' ) { case 'header.inc': case 'social-share.inc': return array( - 5 => 1, + 6 => 1, ); case 'post-edit.inc': // Template file - all OK, fall through to the default case. diff --git a/WPThemeReview/Tests/CoreFunctionality/ThemeTemplatesException/attachment.inc b/WPThemeReview/Tests/CoreFunctionality/ThemeTemplatesException/attachment.inc index a5e47131..2ef34fc0 100644 --- a/WPThemeReview/Tests/CoreFunctionality/ThemeTemplatesException/attachment.inc +++ b/WPThemeReview/Tests/CoreFunctionality/ThemeTemplatesException/attachment.inc @@ -1,7 +1,8 @@ // phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[] my_theme +// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[] template-parts,templates,partials