LineLengthUnitTest
extends AbstractSniffUnitTest
in package
Unit test class for the LineLength sniff.
Tags
Table of Contents
Properties
- $standardsDir : string
- The path to the standard's main directory.
- $testsDir : string
- The path to the standard's test directory.
- $backupGlobals : bool
- Enable or disable the backup and restoration of the $GLOBALS array.
Methods
- generateFailureMessages() : array<string|int, mixed>
- Generate a list of test failures for a given sniffed file.
- getErrorList() : array<int, int>
- Returns the lines where errors should occur.
- getWarningList() : array<int, int>
- Returns the lines where warnings should occur.
- setCliValues() : void
- Get a list of CLI values to set before the file is tested.
- testSniff() : void
- Tests the extending classes Sniff class.
- getTestFiles() : array<string|int, string>
- Get a list of all test files to check.
- setUpPrerequisites() : void
- Sets up this unit test.
- shouldSkipTest() : bool
- Should this test be skipped for some reason.
Properties
$standardsDir
The path to the standard's main directory.
public
string
$standardsDir
= null
$testsDir
The path to the standard's test directory.
public
string
$testsDir
= null
$backupGlobals
Enable or disable the backup and restoration of the $GLOBALS array.
protected
bool
$backupGlobals
= false
Overwrite this attribute in a child class of TestCase. Setting this attribute in setUp() has no effect!
Methods
generateFailureMessages()
Generate a list of test failures for a given sniffed file.
public
generateFailureMessages(LocalFile $file) : array<string|int, mixed>
Parameters
- $file : LocalFile
-
The file being tested.
Tags
Return values
array<string|int, mixed>getErrorList()
Returns the lines where errors should occur.
public
getErrorList([string $testFile = '' ]) : array<int, int>
The key of the array should represent the line number and the value should represent the number of errors that should occur on that line.
Parameters
- $testFile : string = ''
-
The name of the file being tested.
Return values
array<int, int>getWarningList()
Returns the lines where warnings should occur.
public
getWarningList([string $testFile = '' ]) : array<int, int>
The key of the array should represent the line number and the value should represent the number of warnings that should occur on that line.
Parameters
- $testFile : string = ''
-
The name of the file being tested.
Return values
array<int, int>setCliValues()
Get a list of CLI values to set before the file is tested.
public
setCliValues(string $testFile, Config $config) : void
Parameters
- $testFile : string
-
The name of the file being tested.
- $config : Config
-
The config data for the test run.
testSniff()
Tests the extending classes Sniff class.
public
final testSniff() : void
Tags
getTestFiles()
Get a list of all test files to check.
protected
getTestFiles(string $testFileBase) : array<string|int, string>
These will have the same base as the sniff name but different extensions. We ignore the .php file as it is the class.
Parameters
- $testFileBase : string
-
The base path that the unit tests files will have.
Return values
array<string|int, string>setUpPrerequisites()
Sets up this unit test.
protected
setUpPrerequisites() : void
Tags
shouldSkipTest()
Should this test be skipped for some reason.
protected
shouldSkipTest() : bool