PHP Class PhpCsFixer\Test\AbstractFixerTestCase

Author: Dariusz Rumiński ([email protected])
Inheritance: extends PHPUnit_Framework_TestCase
Afficher le fichier Open project: friendsofphp/php-cs-fixer Class Usage Examples

Protected Properties

Свойство Type Description
$fixer null | PhpCsFixer\Fixer\FixerInterface
$linter PhpCsFixer\Linter\LinterInterface

Méthodes protégées

Méthode Description
createFixer ( ) : PhpCsFixer\Fixer\FixerInterface
createFixerFactory ( ) : FixerFactory Create fixer factory with all needed fixers registered.
doTest ( string $expected, string | null $input = null, SplFileInfo $file = null ) Tests if a fixer fixes a given string to match the expected result.
getFixerName ( ) : string
getTestFile ( string $filename = __FILE__ ) : SplFileInfo
lintSource ( string $source ) : string | null
setUp ( )

Private Methods

Méthode Description
assertTokens ( Tokens $expectedTokens, Tokens $inputTokens )
getFixerClassName ( ) : string
getLinter ( ) : PhpCsFixer\Linter\LinterInterface

Method Details

createFixer() protected méthode

protected createFixer ( ) : PhpCsFixer\Fixer\FixerInterface
Résultat PhpCsFixer\Fixer\FixerInterface

createFixerFactory() protected méthode

Create fixer factory with all needed fixers registered.
protected createFixerFactory ( ) : FixerFactory
Résultat PhpCsFixer\FixerFactory

doTest() protected méthode

It is used both if you want to test if something is fixed or if it is not touched by the fixer. It also makes sure that the expected output does not change when run through the fixer. That means that you do not need two test cases like [$expected] and [$expected, $input] (where $expected is the same in both cases) as the latter covers both of them. This method throws an exception if $expected and $input are equal to prevent test cases that accidentally do not test anything.
protected doTest ( string $expected, string | null $input = null, SplFileInfo $file = null )
$expected string The expected fixer output
$input string | null The fixer input, or null if it should intentionally be equal to the output
$file SplFileInfo The file to fix, or null if unneeded

getFixerName() protected méthode

protected getFixerName ( ) : string
Résultat string

getTestFile() protected méthode

protected getTestFile ( string $filename = __FILE__ ) : SplFileInfo
$filename string
Résultat SplFileInfo

lintSource() protected méthode

protected lintSource ( string $source ) : string | null
$source string
Résultat string | null

setUp() protected méthode

protected setUp ( )

Property Details

$fixer protected_oe property

protected null|FixerInterface,PhpCsFixer\Fixer $fixer
Résultat null | PhpCsFixer\Fixer\FixerInterface

$linter protected_oe property

protected LinterInterface,PhpCsFixer\Linter $linter
Résultat PhpCsFixer\Linter\LinterInterface