Documentation

RuleInclusionTest extends TestCase
in package

FinalYes

Tests for the \PHP_CodeSniffer\Ruleset class.

Tags
covers

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

$contents

The original content of the ruleset.

private static string $contents = ''

Methods

dataRegisteredSniffCodes()

Data provider.

public static dataRegisteredSniffCodes() : array<string|int, array<string|int, string>>
Tags
see
self::testRegisteredSniffCodes()
Return values
array<string|int, array<string|int, string>>

dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()

Data provider.

public static dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails() : mixed
Tags
see
self::testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()
@return

array<string, array>string, string>>

dataSettingProperties()

Data provider.

public static dataSettingProperties() : array<string, array<string, string|int|bool>>
Tags
see
self::testSettingProperties()
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
beforeClass

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
dataProvider

dataRegisteredSniffCodes

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
dataProvider

dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails

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.

Tags
dataProvider

dataSettingProperties


        
On this page

Search results