Documentation

PHPUnit_Util_Test
in package

Test helpers.

Tags
since

Class available since Release 3.0.0

Table of Contents

LARGE  = 2
MEDIUM  = 1
REGEX_DATA_PROVIDER  = '/@dataProvider\s+([a-zA-Z0-9._:-\\x7f-\xff]+)/'
REGEX_EXPECTED_EXCEPTION  = '(@expectedException\s+([:.\w\\x7f-\xff]+)(?:[\t ]+(\S*))?(?:[\t ]+(\S*))?\s*$)m'
REGEX_REQUIRES  = '/@requires\s+(?P<name>function|extension)\s+(?P<value>([^ ]+?))[ \t]*\r?$/m'
REGEX_REQUIRES_OS  = '/@requires\s+OS\s+(?P<value>.+?)[ \t]*\r?$/m'
REGEX_REQUIRES_VERSION  = '/@requires\s+(?P<name>PHP(?:Unit)?)\s+(?P<value>[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m'
REGEX_TEST_WITH  = '/@testWith\s+/'
SMALL  = 0
UNKNOWN  = -1
$annotationCache  : mixed
$hookMethods  : mixed
describe()  : mixed
getBackupSettings()  : array<string|int, mixed>
Returns the backup settings for a test.
getDataFromTestWithAnnotation()  : array<string|int, mixed>
getDependencies()  : array<string|int, mixed>
Returns the dependencies for a test class or method.
getErrorHandlerSettings()  : bool
Returns the error handler settings for a test.
getExpectedException()  : array<string|int, mixed>
Returns the expected exception for a test.
getGroups()  : array<string|int, mixed>
Returns the groups for a test class or method.
getHookMethods()  : array<string|int, mixed>
getLinesToBeCovered()  : array<string|int, mixed>|bool
getLinesToBeUsed()  : array<string|int, mixed>
Returns lines of code specified with the @uses annotation.
getMissingRequirements()  : array<string|int, mixed>
Returns the missing requirements for a test.
getPreserveGlobalStateSettings()  : bool
Returns the preserve global state settings for a test.
getProcessIsolationSettings()  : bool
Returns the process isolation settings for a test.
getProvidedData()  : array<string|int, mixed>|Iterator
Returns the provided data for a method.
getRequirements()  : array<string|int, mixed>
Returns the requirements for a test.
getSize()  : int
Returns the size of the test.
getTickets()  : array<string|int, mixed>
Returns the tickets for a test class or method.
parseTestMethodAnnotations()  : array<string|int, mixed>
cleanUpMultiLineAnnotation()  : mixed
emptyHookMethodsArray()  : array<string|int, mixed>
getBooleanAnnotationSetting()  : bool
getDataFromDataProviderAnnotation()  : array<string|int, mixed>|Iterator
Returns the provided data for a method.
getLinesToBeCoveredOrUsed()  : array<string|int, mixed>
isAfterClassMethod()  : bool
isAfterMethod()  : bool
isBeforeClassMethod()  : bool
isBeforeMethod()  : bool
parseAnnotationContent()  : string
Parse annotation content to use constant/class constant values
parseAnnotations()  : array<string|int, mixed>
resolveElementToReflectionObjects()  : array<string|int, mixed>
resolveReflectionObjectsToLines()  : array<string|int, mixed>

Constants

LARGE

public mixed LARGE = 2

MEDIUM

public mixed MEDIUM = 1

REGEX_DATA_PROVIDER

public mixed REGEX_DATA_PROVIDER = '/@dataProvider\s+([a-zA-Z0-9._:-\\x7f-\xff]+)/'

REGEX_EXPECTED_EXCEPTION

public mixed REGEX_EXPECTED_EXCEPTION = '(@expectedException\s+([:.\w\\x7f-\xff]+)(?:[\t ]+(\S*))?(?:[\t ]+(\S*))?\s*$)m'

REGEX_REQUIRES

public mixed REGEX_REQUIRES = '/@requires\s+(?P<name>function|extension)\s+(?P<value>([^ ]+?))[ \t]*\r?$/m'

REGEX_REQUIRES_OS

public mixed REGEX_REQUIRES_OS = '/@requires\s+OS\s+(?P<value>.+?)[ \t]*\r?$/m'

REGEX_REQUIRES_VERSION

public mixed REGEX_REQUIRES_VERSION = '/@requires\s+(?P<name>PHP(?:Unit)?)\s+(?P<value>[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m'

REGEX_TEST_WITH

public mixed REGEX_TEST_WITH = '/@testWith\s+/'

SMALL

public mixed SMALL = ""

UNKNOWN

public mixed UNKNOWN = -1

Properties

$annotationCache

private static mixed $annotationCache = array()

$hookMethods

private static mixed $hookMethods = array()

Methods

getBackupSettings()

Returns the backup settings for a test.

public static getBackupSettings(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.4.0

Return values
array<string|int, mixed>

getDataFromTestWithAnnotation()

public static getDataFromTestWithAnnotation(string $docComment) : array<string|int, mixed>
Parameters
$docComment : string

full docComment string

Tags
throws
PHPUnit_Framework_Exception

when @testWith annotation is defined but cannot be parsed

Return values
array<string|int, mixed>

when @testWith annotation is defined null when @testWith annotation is omitted

getDependencies()

Returns the dependencies for a test class or method.

public static getDependencies(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.4.0

Return values
array<string|int, mixed>

getErrorHandlerSettings()

Returns the error handler settings for a test.

public static getErrorHandlerSettings(string $className, string $methodName) : bool
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.4.0

Return values
bool

getExpectedException()

Returns the expected exception for a test.

public static getExpectedException(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.3.6

Return values
array<string|int, mixed>

getGroups()

Returns the groups for a test class or method.

public static getGroups(string $className[, string $methodName = '' ]) : array<string|int, mixed>
Parameters
$className : string
$methodName : string = ''
Tags
since

Method available since Release 3.2.0

Return values
array<string|int, mixed>

getHookMethods()

public static getHookMethods(string $className) : array<string|int, mixed>
Parameters
$className : string
Tags
since

Method available since Release 4.0.8

Return values
array<string|int, mixed>

getLinesToBeCovered()

public static getLinesToBeCovered(string $className, string $methodName) : array<string|int, mixed>|bool
Parameters
$className : string
$methodName : string
Tags
throws
PHPUnit_Framework_CodeCoverageException
since

Method available since Release 4.0.0

Return values
array<string|int, mixed>|bool

getLinesToBeUsed()

Returns lines of code specified with the @uses annotation.

public static getLinesToBeUsed(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 4.0.0

Return values
array<string|int, mixed>

getMissingRequirements()

Returns the missing requirements for a test.

public static getMissingRequirements(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 4.3.0

Return values
array<string|int, mixed>

getPreserveGlobalStateSettings()

Returns the preserve global state settings for a test.

public static getPreserveGlobalStateSettings(string $className, string $methodName) : bool
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.4.0

Return values
bool

getProcessIsolationSettings()

Returns the process isolation settings for a test.

public static getProcessIsolationSettings(string $className, string $methodName) : bool
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.4.1

Return values
bool

getProvidedData()

Returns the provided data for a method.

public static getProvidedData(string $className, string $methodName) : array<string|int, mixed>|Iterator
Parameters
$className : string
$methodName : string
Tags
throws
PHPUnit_Framework_Exception
since

Method available since Release 3.2.0

Return values
array<string|int, mixed>|Iterator

when a data provider is specified and exists null when no data provider is specified

getRequirements()

Returns the requirements for a test.

public static getRequirements(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.6.0

Return values
array<string|int, mixed>

getSize()

Returns the size of the test.

public static getSize(string $className, string $methodName) : int
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.6.0

Return values
int

getTickets()

Returns the tickets for a test class or method.

public static getTickets(string $className, string $methodName) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
Tags
since

Method available since Release 3.4.0

Return values
array<string|int, mixed>

parseTestMethodAnnotations()

public static parseTestMethodAnnotations(string $className[, string $methodName = '' ]) : array<string|int, mixed>
Parameters
$className : string
$methodName : string = ''
Tags
throws
ReflectionException
since

Method available since Release 3.4.0

Return values
array<string|int, mixed>

cleanUpMultiLineAnnotation()

private static cleanUpMultiLineAnnotation(mixed $docComment) : mixed
Parameters
$docComment : mixed
Return values
mixed

emptyHookMethodsArray()

private static emptyHookMethodsArray() : array<string|int, mixed>
Tags
since

Method available since Release 4.0.9

Return values
array<string|int, mixed>

getBooleanAnnotationSetting()

private static getBooleanAnnotationSetting(string $className, string $methodName, string $settingName) : bool
Parameters
$className : string
$methodName : string
$settingName : string
Tags
since

Method available since Release 3.4.0

Return values
bool

getDataFromDataProviderAnnotation()

Returns the provided data for a method.

private static getDataFromDataProviderAnnotation(string $docComment, string $className, string $methodName) : array<string|int, mixed>|Iterator
Parameters
$docComment : string
$className : string
$methodName : string
Tags
throws
PHPUnit_Framework_Exception
Return values
array<string|int, mixed>|Iterator

when a data provider is specified and exists null when no data provider is specified

getLinesToBeCoveredOrUsed()

private static getLinesToBeCoveredOrUsed(string $className, string $methodName, string $mode) : array<string|int, mixed>
Parameters
$className : string
$methodName : string
$mode : string
Tags
throws
PHPUnit_Framework_CodeCoverageException
since

Method available since Release 4.2.0

Return values
array<string|int, mixed>

isAfterClassMethod()

private static isAfterClassMethod(ReflectionMethod $method) : bool
Parameters
$method : ReflectionMethod
Tags
since

Method available since Release 4.0.8

Return values
bool

isAfterMethod()

private static isAfterMethod(ReflectionMethod $method) : bool
Parameters
$method : ReflectionMethod
Tags
since

Method available since Release 4.0.8

Return values
bool

isBeforeClassMethod()

private static isBeforeClassMethod(ReflectionMethod $method) : bool
Parameters
$method : ReflectionMethod
Tags
since

Method available since Release 4.0.8

Return values
bool

isBeforeMethod()

private static isBeforeMethod(ReflectionMethod $method) : bool
Parameters
$method : ReflectionMethod
Tags
since

Method available since Release 4.0.8

Return values
bool

parseAnnotationContent()

Parse annotation content to use constant/class constant values

private static parseAnnotationContent(string $message) : string

Constants are specified using a starting '@'. For example: @ClassName::CONST_NAME

If the constant is not found the string is used as is to ensure maximum BC.

Parameters
$message : string
Return values
string

parseAnnotations()

private static parseAnnotations(string $docblock) : array<string|int, mixed>
Parameters
$docblock : string
Tags
since

Method available since Release 3.4.0

Return values
array<string|int, mixed>

resolveElementToReflectionObjects()

private static resolveElementToReflectionObjects(string $element) : array<string|int, mixed>
Parameters
$element : string
Tags
throws
PHPUnit_Framework_InvalidCoversTargetException
since

Method available since Release 4.0.0

Return values
array<string|int, mixed>

resolveReflectionObjectsToLines()

private static resolveReflectionObjectsToLines(array<string|int, mixed> $reflectors) : array<string|int, mixed>
Parameters
$reflectors : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results