Skip to content

Commit

Permalink
Fix the tests and sniff
Browse files Browse the repository at this point in the history
Remove the folder from the sniff, and update tests.
  • Loading branch information
dingo-d committed May 9, 2019
1 parent 217e2f2 commit 42ce8a2
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[] my_theme
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[] template-parts,templates,partials
<?php

$my_theme_var = 123; // OK, prefixed.
$var = 'Value'; // OK, template file.
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[]

// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[]
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[] my_theme
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[] template-parts,templates,partials
<?php

$my_theme_var = 123; // OK, prefixed.
$var = 'Value'; // Error. Not in a template file.
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[]
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[]
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[] my_theme
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[] template-parts,templates,partials
<?php

$my_theme_var = 123; // OK, prefixed.
$var = 'Value'; // Error. Not in a template file.
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[]
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[]
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[] my_theme
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[] template-parts,templates,partials
<?php

$my_theme_var = 123; // OK, prefixed.
$var = 'Value'; // OK, template file.
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[]
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[]
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[] my_theme
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[] template-parts,templates,partials
<?php

$my_theme_var = 123; // OK, prefixed.
$var = 'Value'; // Error. Not in a template file.
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals prefixes[]
// phpcs:set WPThemeReview.CoreFunctionality.PrefixAllGlobals allowed_folders[]

0 comments on commit 42ce8a2

Please sign in to comment.