RuleInclusionTest
extends TestCase
in package
Tests for the \PHP_CodeSniffer\Ruleset class.
Tags
Table of Contents
Properties
- $ruleset : Ruleset
- The Ruleset object.
- $contents : string
- The original content of the ruleset.
- $standard : string
- Path to the ruleset file.
Methods
- dataRegisteredSniffCodes() : array<string|int, array<string|int, string>>
- Data provider.
- dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails() : mixed
- Data provider.
- dataSettingProperties() : array<string, array<string, string|int|bool>>
- Data provider.
- initializeConfigAndRuleset() : void
- Initialize the config and ruleset objects based on the `RuleInclusionTest.xml` ruleset file.
- resetRuleset() : void
- Reset ruleset file.
- testHasSniffCodes() : void
- Test that sniffs are registered.
- testRegisteredSniffCodes() : void
- Test that sniffs are correctly registered, independently of the syntax used to include the sniff.
- testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails() : void
- Test that setting properties for standards, categories on sniffs which don't support the property will silently ignore the property and not set it.
- testSettingProperties() : void
- Test that setting properties for standards, categories, sniffs works for all supported rule inclusion methods.
Properties
$ruleset
The Ruleset object.
protected
static Ruleset
$ruleset
$contents
The original content of the ruleset.
private
static string
$contents
= ''
$standard
Path to the ruleset file.
private
static string
$standard
= ''
Methods
dataRegisteredSniffCodes()
Data provider.
public
static dataRegisteredSniffCodes() : array<string|int, array<string|int, string>>
Tags
Return values
array<string|int, array<string|int, string>>dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()
Data provider.
public
static dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails() : mixed
Tags
dataSettingProperties()
Data provider.
public
static dataSettingProperties() : array<string, array<string, string|int|bool>>
Tags
Return values
array<string, array<string, string|int|bool>>initializeConfigAndRuleset()
Initialize the config and ruleset objects based on the `RuleInclusionTest.xml` ruleset file.
public
static initializeConfigAndRuleset() : void
Tags
resetRuleset()
Reset ruleset file.
public
resetRuleset() : void
Tags
testHasSniffCodes()
Test that sniffs are registered.
public
testHasSniffCodes() : void
testRegisteredSniffCodes()
Test that sniffs are correctly registered, independently of the syntax used to include the sniff.
public
testRegisteredSniffCodes(string $key, string $value) : void
Parameters
- $key : string
-
Expected array key.
- $value : string
-
Expected array value.
Tags
testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()
Test that setting properties for standards, categories on sniffs which don't support the property will silently ignore the property and not set it.
public
testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails(string $sniffClass, string $propertyName) : void
Parameters
- $sniffClass : string
-
The name of the sniff class.
- $propertyName : string
-
The name of the property which should not be set.
Tags
testSettingProperties()
Test that setting properties for standards, categories, sniffs works for all supported rule inclusion methods.
public
testSettingProperties(string $sniffClass, string $propertyName, string|int|bool $expectedValue) : void
Parameters
- $sniffClass : string
-
The name of the sniff class.
- $propertyName : string
-
The name of the changed property.
- $expectedValue : string|int|bool
-
The value expected for the property.