protected function StrictSchemaDisabledSniff::isTestClass in Coder 8.3
Same name and namespace in other branches
- 8.3.x coder_sniffer/DrupalPractice/Sniffs/Objects/StrictSchemaDisabledSniff.php \DrupalPractice\Sniffs\Objects\StrictSchemaDisabledSniff::isTestClass()
Determine if this class is a test class.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:
int $stackPtr The position of the current token: in the stack passed in $tokens.
Return value
bool Returns TRUE if the current class is a test class.
1 call to StrictSchemaDisabledSniff::isTestClass()
- StrictSchemaDisabledSniff::processMemberVar in coder_sniffer/
DrupalPractice/ Sniffs/ Objects/ StrictSchemaDisabledSniff.php - Processes this test, when one of its tokens is encountered.
File
- coder_sniffer/
DrupalPractice/ Sniffs/ Objects/ StrictSchemaDisabledSniff.php, line 79
Class
- StrictSchemaDisabledSniff
- Checks that $strictConfigSchema is not set to FALSE in test classes.
Namespace
DrupalPractice\Sniffs\ObjectsCode
protected function isTestClass(File $phpcsFile, $stackPtr) {
// Only applies to test classes, which have Test in the name.
$tokens = $phpcsFile
->getTokens();
$classPtr = key($tokens[$stackPtr]['conditions']);
$name = $phpcsFile
->findNext([
T_STRING,
], $classPtr);
return strpos($tokens[$name]['content'], 'Test') !== false;
}