Documentation

PHPUnit_Extensions_RepeatedTest extends PHPUnit_Extensions_TestDecorator
in package

A Decorator that runs a test repeatedly.

Tags
since

Class available since Release 2.0.0

Table of Contents

$processIsolation  : bool
$test  : object
The Test to be decorated.
$timesRepeat  : int
$count  : int
__construct()  : mixed
Constructor.
anything()  : PHPUnit_Framework_Constraint_IsAnything
Returns a PHPUnit_Framework_Constraint_IsAnything matcher object.
arrayHasKey()  : PHPUnit_Framework_Constraint_ArrayHasKey
Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object.
assertArrayHasKey()  : mixed
Asserts that an array has a specified key.
assertArrayNotHasKey()  : mixed
Asserts that an array does not have a specified key.
assertArraySubset()  : mixed
Asserts that an array has a specified subset.
assertAttributeContains()  : mixed
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
assertAttributeContainsOnly()  : mixed
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.
assertAttributeCount()  : mixed
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
assertAttributeEmpty()  : mixed
Asserts that a static attribute of a class or an attribute of an object is empty.
assertAttributeEquals()  : mixed
Asserts that a variable is equal to an attribute of an object.
assertAttributeGreaterThan()  : mixed
Asserts that an attribute is greater than another value.
assertAttributeGreaterThanOrEqual()  : mixed
Asserts that an attribute is greater than or equal to another value.
assertAttributeInstanceOf()  : mixed
Asserts that an attribute is of a given type.
assertAttributeInternalType()  : mixed
Asserts that an attribute is of a given type.
assertAttributeLessThan()  : mixed
Asserts that an attribute is smaller than another value.
assertAttributeLessThanOrEqual()  : mixed
Asserts that an attribute is smaller than or equal to another value.
assertAttributeNotContains()  : mixed
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle.
assertAttributeNotContainsOnly()  : mixed
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type.
assertAttributeNotCount()  : mixed
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
assertAttributeNotEmpty()  : mixed
Asserts that a static attribute of a class or an attribute of an object is not empty.
assertAttributeNotEquals()  : mixed
Asserts that a variable is not equal to an attribute of an object.
assertAttributeNotInstanceOf()  : mixed
Asserts that an attribute is of a given type.
assertAttributeNotInternalType()  : mixed
Asserts that an attribute is of a given type.
assertAttributeNotSame()  : mixed
Asserts that a variable and an attribute of an object do not have the same type and value.
assertAttributeSame()  : mixed
Asserts that a variable and an attribute of an object have the same type and value.
assertClassHasAttribute()  : mixed
Asserts that a class has a specified attribute.
assertClassHasStaticAttribute()  : mixed
Asserts that a class has a specified static attribute.
assertClassNotHasAttribute()  : mixed
Asserts that a class does not have a specified attribute.
assertClassNotHasStaticAttribute()  : mixed
Asserts that a class does not have a specified static attribute.
assertContains()  : mixed
Asserts that a haystack contains a needle.
assertContainsOnly()  : mixed
Asserts that a haystack contains only values of a given type.
assertContainsOnlyInstancesOf()  : mixed
Asserts that a haystack contains only instances of a given classname
assertCount()  : mixed
Asserts the number of elements of an array, Countable or Traversable.
assertEmpty()  : mixed
Asserts that a variable is empty.
assertEquals()  : mixed
Asserts that two variables are equal.
assertEqualXMLStructure()  : mixed
Asserts that a hierarchy of DOMElements matches.
assertFalse()  : mixed
Asserts that a condition is false.
assertFileEquals()  : mixed
Asserts that the contents of one file is equal to the contents of another file.
assertFileExists()  : mixed
Asserts that a file exists.
assertFileNotEquals()  : mixed
Asserts that the contents of one file is not equal to the contents of another file.
assertFileNotExists()  : mixed
Asserts that a file does not exist.
assertGreaterThan()  : mixed
Asserts that a value is greater than another value.
assertGreaterThanOrEqual()  : mixed
Asserts that a value is greater than or equal to another value.
assertInstanceOf()  : mixed
Asserts that a variable is of a given type.
assertInternalType()  : mixed
Asserts that a variable is of a given type.
assertJson()  : mixed
Asserts that a string is a valid JSON string.
assertJsonFileEqualsJsonFile()  : mixed
Asserts that two JSON files are equal.
assertJsonFileNotEqualsJsonFile()  : mixed
Asserts that two JSON files are not equal.
assertJsonStringEqualsJsonFile()  : mixed
Asserts that the generated JSON encoded object and the content of the given file are equal.
assertJsonStringEqualsJsonString()  : mixed
Asserts that two given JSON encoded objects or arrays are equal.
assertJsonStringNotEqualsJsonFile()  : mixed
Asserts that the generated JSON encoded object and the content of the given file are not equal.
assertJsonStringNotEqualsJsonString()  : mixed
Asserts that two given JSON encoded objects or arrays are not equal.
assertLessThan()  : mixed
Asserts that a value is smaller than another value.
assertLessThanOrEqual()  : mixed
Asserts that a value is smaller than or equal to another value.
assertNotContains()  : mixed
Asserts that a haystack does not contain a needle.
assertNotContainsOnly()  : mixed
Asserts that a haystack does not contain only values of a given type.
assertNotCount()  : mixed
Asserts the number of elements of an array, Countable or Traversable.
assertNotEmpty()  : mixed
Asserts that a variable is not empty.
assertNotEquals()  : mixed
Asserts that two variables are not equal.
assertNotFalse()  : mixed
Asserts that a condition is not false.
assertNotInstanceOf()  : mixed
Asserts that a variable is not of a given type.
assertNotInternalType()  : mixed
Asserts that a variable is not of a given type.
assertNotNull()  : mixed
Asserts that a variable is not null.
assertNotRegExp()  : mixed
Asserts that a string does not match a given regular expression.
assertNotSame()  : mixed
Asserts that two variables do not have the same type and value.
assertNotSameSize()  : mixed
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.
assertNotTag()  : mixed
This assertion is the exact opposite of assertTag().
assertNotTrue()  : mixed
Asserts that a condition is not true.
assertNull()  : mixed
Asserts that a variable is null.
assertObjectHasAttribute()  : mixed
Asserts that an object has a specified attribute.
assertObjectNotHasAttribute()  : mixed
Asserts that an object does not have a specified attribute.
assertRegExp()  : mixed
Asserts that a string matches a given regular expression.
assertSame()  : mixed
Asserts that two variables have the same type and value.
assertSameSize()  : mixed
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.
assertSelectCount()  : mixed
Assert the presence, absence, or count of elements in a document matching the CSS $selector, regardless of the contents of those elements.
assertSelectEquals()  : mixed
assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?
assertSelectRegExp()  : mixed
assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml); // 3?
assertStringEndsNotWith()  : mixed
Asserts that a string ends not with a given suffix.
assertStringEndsWith()  : mixed
Asserts that a string ends with a given suffix.
assertStringEqualsFile()  : mixed
Asserts that the contents of a string is equal to the contents of a file.
assertStringMatchesFormat()  : mixed
Asserts that a string matches a given format string.
assertStringMatchesFormatFile()  : mixed
Asserts that a string matches a given format file.
assertStringNotEqualsFile()  : mixed
Asserts that the contents of a string is not equal to the contents of a file.
assertStringNotMatchesFormat()  : mixed
Asserts that a string does not match a given format string.
assertStringNotMatchesFormatFile()  : mixed
Asserts that a string does not match a given format string.
assertStringStartsNotWith()  : mixed
Asserts that a string starts not with a given prefix.
assertStringStartsWith()  : mixed
Asserts that a string starts with a given prefix.
assertTag()  : mixed
Evaluate an HTML or XML string and assert its structure and/or contents.
assertThat()  : mixed
Evaluates a PHPUnit_Framework_Constraint matcher object.
assertTrue()  : mixed
Asserts that a condition is true.
assertXmlFileEqualsXmlFile()  : mixed
Asserts that two XML files are equal.
assertXmlFileNotEqualsXmlFile()  : mixed
Asserts that two XML files are not equal.
assertXmlStringEqualsXmlFile()  : mixed
Asserts that two XML documents are equal.
assertXmlStringEqualsXmlString()  : mixed
Asserts that two XML documents are equal.
assertXmlStringNotEqualsXmlFile()  : mixed
Asserts that two XML documents are not equal.
assertXmlStringNotEqualsXmlString()  : mixed
Asserts that two XML documents are not equal.
attribute()  : PHPUnit_Framework_Constraint_Attribute
Returns a PHPUnit_Framework_Constraint_Attribute matcher object.
attributeEqualTo()  : PHPUnit_Framework_Constraint_Attribute
Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object.
basicRun()  : mixed
Runs the test and collects the result in a TestResult.
callback()  : PHPUnit_Framework_Constraint_Callback
Returns a PHPUnit_Framework_Constraint_Callback matcher object.
classHasAttribute()  : PHPUnit_Framework_Constraint_ClassHasAttribute
Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object.
classHasStaticAttribute()  : PHPUnit_Framework_Constraint_ClassHasStaticAttribute
Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object.
contains()  : PHPUnit_Framework_Constraint_TraversableContains
Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object.
containsOnly()  : PHPUnit_Framework_Constraint_TraversableContainsOnly
Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.
containsOnlyInstancesOf()  : PHPUnit_Framework_Constraint_TraversableContainsOnly
Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.
count()  : int
Counts the number of test cases that will be run by this test.
countOf()  : PHPUnit_Framework_Constraint_Count
Returns a PHPUnit_Framework_Constraint_Count matcher object.
equalTo()  : PHPUnit_Framework_Constraint_IsEqual
Returns a PHPUnit_Framework_Constraint_IsEqual matcher object.
fail()  : mixed
Fails a test with the given message.
fileExists()  : PHPUnit_Framework_Constraint_FileExists
Returns a PHPUnit_Framework_Constraint_FileExists matcher object.
getCount()  : int
Return the current assertion count.
getObjectAttribute()  : mixed
Returns the value of an object's attribute.
getStaticAttribute()  : mixed
Returns the value of a static attribute.
getTest()  : PHPUnit_Framework_Test
Returns the test to be run.
greaterThan()  : PHPUnit_Framework_Constraint_GreaterThan
Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object.
greaterThanOrEqual()  : PHPUnit_Framework_Constraint_Or
Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object.
identicalTo()  : PHPUnit_Framework_Constraint_IsIdentical
Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object.
isEmpty()  : PHPUnit_Framework_Constraint_IsEmpty
Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object.
isFalse()  : PHPUnit_Framework_Constraint_IsFalse
Returns a PHPUnit_Framework_Constraint_IsFalse matcher object.
isInstanceOf()  : PHPUnit_Framework_Constraint_IsInstanceOf
Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object.
isJson()  : PHPUnit_Framework_Constraint_IsJson
Returns a PHPUnit_Framework_Constraint_IsJson matcher object.
isNull()  : PHPUnit_Framework_Constraint_IsNull
Returns a PHPUnit_Framework_Constraint_IsNull matcher object.
isTrue()  : PHPUnit_Framework_Constraint_IsTrue
Returns a PHPUnit_Framework_Constraint_IsTrue matcher object.
isType()  : PHPUnit_Framework_Constraint_IsType
Returns a PHPUnit_Framework_Constraint_IsType matcher object.
lessThan()  : PHPUnit_Framework_Constraint_LessThan
Returns a PHPUnit_Framework_Constraint_LessThan matcher object.
lessThanOrEqual()  : PHPUnit_Framework_Constraint_Or
Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.
logicalAnd()  : PHPUnit_Framework_Constraint_And
Returns a PHPUnit_Framework_Constraint_And matcher object.
logicalNot()  : PHPUnit_Framework_Constraint_Not
Returns a PHPUnit_Framework_Constraint_Not matcher object.
logicalOr()  : PHPUnit_Framework_Constraint_Or
Returns a PHPUnit_Framework_Constraint_Or matcher object.
logicalXor()  : PHPUnit_Framework_Constraint_Xor
Returns a PHPUnit_Framework_Constraint_Xor matcher object.
markTestIncomplete()  : mixed
Mark the test as incomplete.
markTestSkipped()  : mixed
Mark the test as skipped.
matches()  : PHPUnit_Framework_Constraint_StringMatches
Returns a PHPUnit_Framework_Constraint_StringMatches matcher object.
matchesRegularExpression()  : PHPUnit_Framework_Constraint_PCREMatch
Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object.
objectHasAttribute()  : PHPUnit_Framework_Constraint_ObjectHasAttribute
Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object.
readAttribute()  : mixed
Returns the value of an attribute of a class or an object.
resetCount()  : mixed
Reset the assertion counter.
run()  : PHPUnit_Framework_TestResult
Runs the decorated test and collects the result in a TestResult.
stringContains()  : PHPUnit_Framework_Constraint_StringContains
Returns a PHPUnit_Framework_Constraint_StringContains matcher object.
stringEndsWith()  : PHPUnit_Framework_Constraint_StringEndsWith
Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object.
stringStartsWith()  : PHPUnit_Framework_Constraint_StringStartsWith
Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object.
toString()  : string
Returns a string representation of the test.
createResult()  : PHPUnit_Framework_TestResult
Creates a default TestResult object.

Properties

$processIsolation

protected bool $processIsolation = alse

$test

The Test to be decorated.

protected object $test = ull

$count

private static int $count = 0

Methods

assertArrayHasKey()

Asserts that an array has a specified key.

public static assertArrayHasKey(mixed $key, array<string|int, mixed>|ArrayAccess $array[, string $message = '' ]) : mixed
Parameters
$key : mixed
$array : array<string|int, mixed>|ArrayAccess
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertArrayNotHasKey()

Asserts that an array does not have a specified key.

public static assertArrayNotHasKey(mixed $key, array<string|int, mixed>|ArrayAccess $array[, string $message = '' ]) : mixed
Parameters
$key : mixed
$array : array<string|int, mixed>|ArrayAccess
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertArraySubset()

Asserts that an array has a specified subset.

public static assertArraySubset(array<string|int, mixed>|ArrayAccess $subset, array<string|int, mixed>|ArrayAccess $array[, bool $strict = false ][, string $message = '' ]) : mixed
Parameters
$subset : array<string|int, mixed>|ArrayAccess
$array : array<string|int, mixed>|ArrayAccess
$strict : bool = false

Check for object identity

$message : string = ''
Tags
since

Method available since Release 4.4.0

Return values
mixed

assertAttributeContains()

Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.

public static assertAttributeContains(mixed $needle, string $haystackAttributeName, mixed $haystackClassOrObject[, string $message = '' ][, bool $ignoreCase = false ][, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : mixed
Parameters
$needle : mixed
$haystackAttributeName : string
$haystackClassOrObject : mixed
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertAttributeContainsOnly()

Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.

public static assertAttributeContainsOnly(string $type, string $haystackAttributeName, mixed $haystackClassOrObject[, bool $isNativeType = null ][, string $message = '' ]) : mixed
Parameters
$type : string
$haystackAttributeName : string
$haystackClassOrObject : mixed
$isNativeType : bool = null
$message : string = ''
Tags
since

Method available since Release 3.1.4

Return values
mixed

assertAttributeCount()

Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.

public static assertAttributeCount(int $expectedCount, string $haystackAttributeName, mixed $haystackClassOrObject[, string $message = '' ]) : mixed
Parameters
$expectedCount : int
$haystackAttributeName : string
$haystackClassOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.6.0

Return values
mixed

assertAttributeEmpty()

Asserts that a static attribute of a class or an attribute of an object is empty.

public static assertAttributeEmpty(string $haystackAttributeName, mixed $haystackClassOrObject[, string $message = '' ]) : mixed
Parameters
$haystackAttributeName : string
$haystackClassOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertAttributeEquals()

Asserts that a variable is equal to an attribute of an object.

public static assertAttributeEquals(mixed $expected, string $actualAttributeName, string $actualClassOrObject[, string $message = '' ][, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : string
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Return values
mixed

assertAttributeGreaterThan()

Asserts that an attribute is greater than another value.

public static assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, string $actualClassOrObject[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertAttributeGreaterThanOrEqual()

Asserts that an attribute is greater than or equal to another value.

public static assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, string $actualClassOrObject[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertAttributeInstanceOf()

Asserts that an attribute is of a given type.

public static assertAttributeInstanceOf(string $expected, string $attributeName, mixed $classOrObject[, string $message = '' ]) : mixed
Parameters
$expected : string
$attributeName : string
$classOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertAttributeInternalType()

Asserts that an attribute is of a given type.

public static assertAttributeInternalType(string $expected, string $attributeName, mixed $classOrObject[, string $message = '' ]) : mixed
Parameters
$expected : string
$attributeName : string
$classOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertAttributeLessThan()

Asserts that an attribute is smaller than another value.

public static assertAttributeLessThan(mixed $expected, string $actualAttributeName, string $actualClassOrObject[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertAttributeLessThanOrEqual()

Asserts that an attribute is smaller than or equal to another value.

public static assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, string $actualClassOrObject[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertAttributeNotContains()

Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle.

public static assertAttributeNotContains(mixed $needle, string $haystackAttributeName, mixed $haystackClassOrObject[, string $message = '' ][, bool $ignoreCase = false ][, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : mixed
Parameters
$needle : mixed
$haystackAttributeName : string
$haystackClassOrObject : mixed
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertAttributeNotContainsOnly()

Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type.

public static assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, mixed $haystackClassOrObject[, bool $isNativeType = null ][, string $message = '' ]) : mixed
Parameters
$type : string
$haystackAttributeName : string
$haystackClassOrObject : mixed
$isNativeType : bool = null
$message : string = ''
Tags
since

Method available since Release 3.1.4

Return values
mixed

assertAttributeNotCount()

Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.

public static assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, mixed $haystackClassOrObject[, string $message = '' ]) : mixed
Parameters
$expectedCount : int
$haystackAttributeName : string
$haystackClassOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.6.0

Return values
mixed

assertAttributeNotEmpty()

Asserts that a static attribute of a class or an attribute of an object is not empty.

public static assertAttributeNotEmpty(string $haystackAttributeName, mixed $haystackClassOrObject[, string $message = '' ]) : mixed
Parameters
$haystackAttributeName : string
$haystackClassOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertAttributeNotEquals()

Asserts that a variable is not equal to an attribute of an object.

public static assertAttributeNotEquals(mixed $expected, string $actualAttributeName, string $actualClassOrObject[, string $message = '' ][, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : string
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Return values
mixed

assertAttributeNotInstanceOf()

Asserts that an attribute is of a given type.

public static assertAttributeNotInstanceOf(string $expected, string $attributeName, mixed $classOrObject[, string $message = '' ]) : mixed
Parameters
$expected : string
$attributeName : string
$classOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertAttributeNotInternalType()

Asserts that an attribute is of a given type.

public static assertAttributeNotInternalType(string $expected, string $attributeName, mixed $classOrObject[, string $message = '' ]) : mixed
Parameters
$expected : string
$attributeName : string
$classOrObject : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertAttributeNotSame()

Asserts that a variable and an attribute of an object do not have the same type and value.

public static assertAttributeNotSame(mixed $expected, string $actualAttributeName, object $actualClassOrObject[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object
$message : string = ''
Return values
mixed

assertAttributeSame()

Asserts that a variable and an attribute of an object have the same type and value.

public static assertAttributeSame(mixed $expected, string $actualAttributeName, object $actualClassOrObject[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object
$message : string = ''
Return values
mixed

assertClassHasAttribute()

Asserts that a class has a specified attribute.

public static assertClassHasAttribute(string $attributeName, string $className[, string $message = '' ]) : mixed
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertClassHasStaticAttribute()

Asserts that a class has a specified static attribute.

public static assertClassHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : mixed
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertClassNotHasAttribute()

Asserts that a class does not have a specified attribute.

public static assertClassNotHasAttribute(string $attributeName, string $className[, string $message = '' ]) : mixed
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertClassNotHasStaticAttribute()

Asserts that a class does not have a specified static attribute.

public static assertClassNotHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : mixed
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertContains()

Asserts that a haystack contains a needle.

public static assertContains(mixed $needle, mixed $haystack[, string $message = '' ][, bool $ignoreCase = false ][, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : mixed
Parameters
$needle : mixed
$haystack : mixed
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
since

Method available since Release 2.1.0

Return values
mixed

assertContainsOnly()

Asserts that a haystack contains only values of a given type.

public static assertContainsOnly(string $type, mixed $haystack[, bool $isNativeType = null ][, string $message = '' ]) : mixed
Parameters
$type : string
$haystack : mixed
$isNativeType : bool = null
$message : string = ''
Tags
since

Method available since Release 3.1.4

Return values
mixed

assertContainsOnlyInstancesOf()

Asserts that a haystack contains only instances of a given classname

public static assertContainsOnlyInstancesOf(string $classname, array<string|int, mixed>|Traversable $haystack[, string $message = '' ]) : mixed
Parameters
$classname : string
$haystack : array<string|int, mixed>|Traversable
$message : string = ''
Return values
mixed

assertCount()

Asserts the number of elements of an array, Countable or Traversable.

public static assertCount(int $expectedCount, mixed $haystack[, string $message = '' ]) : mixed
Parameters
$expectedCount : int
$haystack : mixed
$message : string = ''
Return values
mixed

assertEmpty()

Asserts that a variable is empty.

public static assertEmpty(mixed $actual[, string $message = '' ]) : mixed
Parameters
$actual : mixed
$message : string = ''
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
mixed

assertEquals()

Asserts that two variables are equal.

public static assertEquals(mixed $expected, mixed $actual[, string $message = '' ][, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Return values
mixed

assertEqualXMLStructure()

Asserts that a hierarchy of DOMElements matches.

public static assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement[, bool $checkAttributes = false ][, string $message = '' ]) : mixed
Parameters
$expectedElement : DOMElement
$actualElement : DOMElement
$checkAttributes : bool = false
$message : string = ''
Tags
since

Method available since Release 3.3.0

Return values
mixed

assertFalse()

Asserts that a condition is false.

public static assertFalse(bool $condition[, string $message = '' ]) : mixed
Parameters
$condition : bool
$message : string = ''
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
mixed

assertFileEquals()

Asserts that the contents of one file is equal to the contents of another file.

public static assertFileEquals(string $expected, string $actual[, string $message = '' ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expected : string
$actual : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 3.2.14

Return values
mixed

assertFileExists()

Asserts that a file exists.

public static assertFileExists(string $filename[, string $message = '' ]) : mixed
Parameters
$filename : string
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertFileNotEquals()

Asserts that the contents of one file is not equal to the contents of another file.

public static assertFileNotEquals(string $expected, string $actual[, string $message = '' ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expected : string
$actual : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 3.2.14

Return values
mixed

assertFileNotExists()

Asserts that a file does not exist.

public static assertFileNotExists(string $filename[, string $message = '' ]) : mixed
Parameters
$filename : string
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertGreaterThan()

Asserts that a value is greater than another value.

public static assertGreaterThan(mixed $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertGreaterThanOrEqual()

Asserts that a value is greater than or equal to another value.

public static assertGreaterThanOrEqual(mixed $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertInstanceOf()

Asserts that a variable is of a given type.

public static assertInstanceOf(string $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertInternalType()

Asserts that a variable is of a given type.

public static assertInternalType(string $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertJson()

Asserts that a string is a valid JSON string.

public static assertJson(string $actualJson[, string $message = '' ]) : mixed
Parameters
$actualJson : string
$message : string = ''
Tags
since

Method available since Release 3.7.20

Return values
mixed

assertJsonFileEqualsJsonFile()

Asserts that two JSON files are equal.

public static assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Return values
mixed

assertJsonFileNotEqualsJsonFile()

Asserts that two JSON files are not equal.

public static assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Return values
mixed

assertJsonStringEqualsJsonFile()

Asserts that the generated JSON encoded object and the content of the given file are equal.

public static assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualJson : string
$message : string = ''
Return values
mixed

assertJsonStringEqualsJsonString()

Asserts that two given JSON encoded objects or arrays are equal.

public static assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson[, string $message = '' ]) : mixed
Parameters
$expectedJson : string
$actualJson : string
$message : string = ''
Return values
mixed

assertJsonStringNotEqualsJsonFile()

Asserts that the generated JSON encoded object and the content of the given file are not equal.

public static assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualJson : string
$message : string = ''
Return values
mixed

assertJsonStringNotEqualsJsonString()

Asserts that two given JSON encoded objects or arrays are not equal.

public static assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson[, string $message = '' ]) : mixed
Parameters
$expectedJson : string
$actualJson : string
$message : string = ''
Return values
mixed

assertLessThan()

Asserts that a value is smaller than another value.

public static assertLessThan(mixed $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertLessThanOrEqual()

Asserts that a value is smaller than or equal to another value.

public static assertLessThanOrEqual(mixed $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertNotContains()

Asserts that a haystack does not contain a needle.

public static assertNotContains(mixed $needle, mixed $haystack[, string $message = '' ][, bool $ignoreCase = false ][, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : mixed
Parameters
$needle : mixed
$haystack : mixed
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
since

Method available since Release 2.1.0

Return values
mixed

assertNotContainsOnly()

Asserts that a haystack does not contain only values of a given type.

public static assertNotContainsOnly(string $type, mixed $haystack[, bool $isNativeType = null ][, string $message = '' ]) : mixed
Parameters
$type : string
$haystack : mixed
$isNativeType : bool = null
$message : string = ''
Tags
since

Method available since Release 3.1.4

Return values
mixed

assertNotCount()

Asserts the number of elements of an array, Countable or Traversable.

public static assertNotCount(int $expectedCount, mixed $haystack[, string $message = '' ]) : mixed
Parameters
$expectedCount : int
$haystack : mixed
$message : string = ''
Return values
mixed

assertNotEmpty()

Asserts that a variable is not empty.

public static assertNotEmpty(mixed $actual[, string $message = '' ]) : mixed
Parameters
$actual : mixed
$message : string = ''
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
mixed

assertNotEquals()

Asserts that two variables are not equal.

public static assertNotEquals(mixed $expected, mixed $actual[, string $message = '' ][, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 2.3.0

Return values
mixed

assertNotFalse()

Asserts that a condition is not false.

public static assertNotFalse(bool $condition[, string $message = '' ]) : mixed
Parameters
$condition : bool
$message : string = ''
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
mixed

assertNotInstanceOf()

Asserts that a variable is not of a given type.

public static assertNotInstanceOf(string $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertNotInternalType()

Asserts that a variable is not of a given type.

public static assertNotInternalType(string $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertNotNull()

Asserts that a variable is not null.

public static assertNotNull(mixed $actual[, string $message = '' ]) : mixed
Parameters
$actual : mixed
$message : string = ''
Return values
mixed

assertNotRegExp()

Asserts that a string does not match a given regular expression.

public static assertNotRegExp(string $pattern, string $string[, string $message = '' ]) : mixed
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
since

Method available since Release 2.1.0

Return values
mixed

assertNotSame()

Asserts that two variables do not have the same type and value.

public static assertNotSame(mixed $expected, mixed $actual[, string $message = '' ]) : mixed

Used on objects, it asserts that two variables do not reference the same object.

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Return values
mixed

assertNotSameSize()

Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.

public static assertNotSameSize(array<string|int, mixed>|Countable|Traversable $expected, array<string|int, mixed>|Countable|Traversable $actual[, string $message = '' ]) : mixed
Parameters
$expected : array<string|int, mixed>|Countable|Traversable
$actual : array<string|int, mixed>|Countable|Traversable
$message : string = ''
Return values
mixed

assertNotTag()

This assertion is the exact opposite of assertTag().

public static assertNotTag(array<string|int, mixed> $matcher, string $actual[, string $message = '' ][, bool $isHtml = true ]) : mixed

Rather than asserting that $matcher results in a match, it asserts that $matcher does not match.

Parameters
$matcher : array<string|int, mixed>
$actual : string
$message : string = ''
$isHtml : bool = true
Tags
since

Method available since Release 3.3.0

deprecated
codeCoverageIgnore
Return values
mixed

assertNotTrue()

Asserts that a condition is not true.

public static assertNotTrue(bool $condition[, string $message = '' ]) : mixed
Parameters
$condition : bool
$message : string = ''
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
mixed

assertNull()

Asserts that a variable is null.

public static assertNull(mixed $actual[, string $message = '' ]) : mixed
Parameters
$actual : mixed
$message : string = ''
Return values
mixed

assertObjectHasAttribute()

Asserts that an object has a specified attribute.

public static assertObjectHasAttribute(string $attributeName, object $object[, string $message = '' ]) : mixed
Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertObjectNotHasAttribute()

Asserts that an object does not have a specified attribute.

public static assertObjectNotHasAttribute(string $attributeName, object $object[, string $message = '' ]) : mixed
Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertRegExp()

Asserts that a string matches a given regular expression.

public static assertRegExp(string $pattern, string $string[, string $message = '' ]) : mixed
Parameters
$pattern : string
$string : string
$message : string = ''
Return values
mixed

assertSame()

Asserts that two variables have the same type and value.

public static assertSame(mixed $expected, mixed $actual[, string $message = '' ]) : mixed

Used on objects, it asserts that two variables reference the same object.

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Return values
mixed

assertSameSize()

Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.

public static assertSameSize(array<string|int, mixed>|Countable|Traversable $expected, array<string|int, mixed>|Countable|Traversable $actual[, string $message = '' ]) : mixed
Parameters
$expected : array<string|int, mixed>|Countable|Traversable
$actual : array<string|int, mixed>|Countable|Traversable
$message : string = ''
Return values
mixed

assertSelectCount()

Assert the presence, absence, or count of elements in a document matching the CSS $selector, regardless of the contents of those elements.

public static assertSelectCount(array<string|int, mixed> $selector, int|bool|array<string|int, mixed> $count, mixed $actual[, string $message = '' ][, bool $isHtml = true ]) : mixed

The first argument, $selector, is the CSS selector used to match the elements in the $actual document.

The second argument, $count, can be either boolean or numeric. When boolean, it asserts for presence of elements matching the selector (true) or absence of elements (false). When numeric, it asserts the count of elements.

assertSelectCount("#binder", true, $xml); // any? assertSelectCount(".binder", 3, $xml); // exactly 3?

Parameters
$selector : array<string|int, mixed>
$count : int|bool|array<string|int, mixed>
$actual : mixed
$message : string = ''
$isHtml : bool = true
Tags
since

Method available since Release 3.3.0

deprecated
codeCoverageIgnore
Return values
mixed

assertSelectEquals()

assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?

public static assertSelectEquals(array<string|int, mixed> $selector, string $content, int|bool|array<string|int, mixed> $count, mixed $actual[, string $message = '' ][, bool $isHtml = true ]) : mixed
Parameters
$selector : array<string|int, mixed>
$content : string
$count : int|bool|array<string|int, mixed>
$actual : mixed
$message : string = ''
$isHtml : bool = true
Tags
since

Method available since Release 3.3.0

deprecated
codeCoverageIgnore
Return values
mixed

assertSelectRegExp()

assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml); // 3?

public static assertSelectRegExp(array<string|int, mixed> $selector, string $pattern, int|bool|array<string|int, mixed> $count, mixed $actual[, string $message = '' ][, bool $isHtml = true ]) : mixed
Parameters
$selector : array<string|int, mixed>
$pattern : string
$count : int|bool|array<string|int, mixed>
$actual : mixed
$message : string = ''
$isHtml : bool = true
Tags
since

Method available since Release 3.3.0

deprecated
codeCoverageIgnore
Return values
mixed

assertStringEndsNotWith()

Asserts that a string ends not with a given suffix.

public static assertStringEndsNotWith(string $suffix, string $string[, string $message = '' ]) : mixed
Parameters
$suffix : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.4.0

Return values
mixed

assertStringEndsWith()

Asserts that a string ends with a given suffix.

public static assertStringEndsWith(string $suffix, string $string[, string $message = '' ]) : mixed
Parameters
$suffix : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.4.0

Return values
mixed

assertStringEqualsFile()

Asserts that the contents of a string is equal to the contents of a file.

public static assertStringEqualsFile(string $expectedFile, string $actualString[, string $message = '' ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 3.3.0

Return values
mixed

assertStringMatchesFormat()

Asserts that a string matches a given format string.

public static assertStringMatchesFormat(string $format, string $string[, string $message = '' ]) : mixed
Parameters
$format : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertStringMatchesFormatFile()

Asserts that a string matches a given format file.

public static assertStringMatchesFormatFile(string $formatFile, string $string[, string $message = '' ]) : mixed
Parameters
$formatFile : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertStringNotEqualsFile()

Asserts that the contents of a string is not equal to the contents of a file.

public static assertStringNotEqualsFile(string $expectedFile, string $actualString[, string $message = '' ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 3.3.0

Return values
mixed

assertStringNotMatchesFormat()

Asserts that a string does not match a given format string.

public static assertStringNotMatchesFormat(string $format, string $string[, string $message = '' ]) : mixed
Parameters
$format : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertStringNotMatchesFormatFile()

Asserts that a string does not match a given format string.

public static assertStringNotMatchesFormatFile(string $formatFile, string $string[, string $message = '' ]) : mixed
Parameters
$formatFile : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.5.0

Return values
mixed

assertStringStartsNotWith()

Asserts that a string starts not with a given prefix.

public static assertStringStartsNotWith(string $prefix, string $string[, string $message = '' ]) : mixed
Parameters
$prefix : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.4.0

Return values
mixed

assertStringStartsWith()

Asserts that a string starts with a given prefix.

public static assertStringStartsWith(string $prefix, string $string[, string $message = '' ]) : mixed
Parameters
$prefix : string
$string : string
$message : string = ''
Tags
since

Method available since Release 3.4.0

Return values
mixed

assertTag()

Evaluate an HTML or XML string and assert its structure and/or contents.

public static assertTag(array<string|int, mixed> $matcher, string $actual[, string $message = '' ][, bool $isHtml = true ]) : mixed

The first argument ($matcher) is an associative array that specifies the match criteria for the assertion:

  • id : the node with the given id attribute must match the corresponding value.
  • tag : the node type must match the corresponding value.
  • attributes : a hash. The node's attributes must match the corresponding values in the hash.
  • content : The text content must match the given value.
  • parent : a hash. The node's parent must match the corresponding hash.
  • child : a hash. At least one of the node's immediate children must meet the criteria described by the hash.
  • ancestor : a hash. At least one of the node's ancestors must meet the criteria described by the hash.
  • descendant : a hash. At least one of the node's descendants must meet the criteria described by the hash.
  • children : a hash, for counting children of a node. Accepts the keys:
    • count : a number which must equal the number of children that match
    • less_than : the number of matching children must be greater than this number
    • greater_than : the number of matching children must be less than this number
    • only : another hash consisting of the keys to use to match on the children, and only matching children will be counted
// Matcher that asserts that there is an element with an id="my_id". $matcher = array('id' => 'my_id');

// Matcher that asserts that there is a "span" tag. $matcher = array('tag' => 'span');

// Matcher that asserts that there is a "span" tag with the content // "Hello World". $matcher = array('tag' => 'span', 'content' => 'Hello World');

// Matcher that asserts that there is a "span" tag with content matching // the regular expression pattern. $matcher = array('tag' => 'span', 'content' => 'regexp:/Try P(HP|ython)/');

// Matcher that asserts that there is a "span" with an "list" class // attribute. $matcher = array( 'tag' => 'span', 'attributes' => array('class' => 'list') );

// Matcher that asserts that there is a "span" inside of a "div". $matcher = array( 'tag' => 'span', 'parent' => array('tag' => 'div') );

// Matcher that asserts that there is a "span" somewhere inside a // "table". $matcher = array( 'tag' => 'span', 'ancestor' => array('tag' => 'table') );

// Matcher that asserts that there is a "span" with at least one "em" // child. $matcher = array( 'tag' => 'span', 'child' => array('tag' => 'em') );

// Matcher that asserts that there is a "span" containing a (possibly // nested) "strong" tag. $matcher = array( 'tag' => 'span', 'descendant' => array('tag' => 'strong') );

// Matcher that asserts that there is a "span" containing 5-10 "em" tags // as immediate children. $matcher = array( 'tag' => 'span', 'children' => array( 'less_than' => 11, 'greater_than' => 4, 'only' => array('tag' => 'em') ) );

// Matcher that asserts that there is a "div", with an "ul" ancestor and // a "li" parent (with class="enum"), and containing a "span" descendant // that contains an element with id="my_test" and the text "Hello World". $matcher = array( 'tag' => 'div', 'ancestor' => array('tag' => 'ul'), 'parent' => array( 'tag' => 'li', 'attributes' => array('class' => 'enum') ), 'descendant' => array( 'tag' => 'span', 'child' => array( 'id' => 'my_test', 'content' => 'Hello World' ) ) );

// Use assertTag() to apply a $matcher to a piece of $html. $this->assertTag($matcher, $html);

// Use assertTag() to apply a $matcher to a piece of $xml. $this->assertTag($matcher, $xml, '', false);

The second argument ($actual) is a string containing either HTML or XML text to be tested.

The third argument ($message) is an optional message that will be used if the assertion fails.

The fourth argument ($html) is an optional flag specifying whether to load the $actual string into a DOMDocument using the HTML or XML load strategy. It is true by default, which assumes the HTML load strategy. In many cases, this will be acceptable for XML as well.

Parameters
$matcher : array<string|int, mixed>
$actual : string
$message : string = ''
$isHtml : bool = true
Tags
since

Method available since Release 3.3.0

deprecated
codeCoverageIgnore
Return values
mixed

assertThat()

Evaluates a PHPUnit_Framework_Constraint matcher object.

public static assertThat(mixed $value, PHPUnit_Framework_Constraint $constraint[, string $message = '' ]) : mixed
Parameters
$value : mixed
$constraint : PHPUnit_Framework_Constraint
$message : string = ''
Tags
since

Method available since Release 3.0.0

Return values
mixed

assertTrue()

Asserts that a condition is true.

public static assertTrue(bool $condition[, string $message = '' ]) : mixed
Parameters
$condition : bool
$message : string = ''
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
mixed

assertXmlFileEqualsXmlFile()

Asserts that two XML files are equal.

public static assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertXmlFileNotEqualsXmlFile()

Asserts that two XML files are not equal.

public static assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertXmlStringEqualsXmlFile()

Asserts that two XML documents are equal.

public static assertXmlStringEqualsXmlFile(string $expectedFile, string $actualXml[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualXml : string
$message : string = ''
Tags
since

Method available since Release 3.3.0

Return values
mixed

assertXmlStringEqualsXmlString()

Asserts that two XML documents are equal.

public static assertXmlStringEqualsXmlString(string $expectedXml, string $actualXml[, string $message = '' ]) : mixed
Parameters
$expectedXml : string
$actualXml : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

assertXmlStringNotEqualsXmlFile()

Asserts that two XML documents are not equal.

public static assertXmlStringNotEqualsXmlFile(string $expectedFile, string $actualXml[, string $message = '' ]) : mixed
Parameters
$expectedFile : string
$actualXml : string
$message : string = ''
Tags
since

Method available since Release 3.3.0

Return values
mixed

assertXmlStringNotEqualsXmlString()

Asserts that two XML documents are not equal.

public static assertXmlStringNotEqualsXmlString(string $expectedXml, string $actualXml[, string $message = '' ]) : mixed
Parameters
$expectedXml : string
$actualXml : string
$message : string = ''
Tags
since

Method available since Release 3.1.0

Return values
mixed

attributeEqualTo()

Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object.

public static attributeEqualTo(string $attributeName, mixed $value[, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : PHPUnit_Framework_Constraint_Attribute
Parameters
$attributeName : string
$value : mixed
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 3.1.0

Return values
PHPUnit_Framework_Constraint_Attribute

contains()

Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object.

public static contains(mixed $value[, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : PHPUnit_Framework_Constraint_TraversableContains
Parameters
$value : mixed
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
since

Method available since Release 3.0.0

Return values
PHPUnit_Framework_Constraint_TraversableContains

count()

Counts the number of test cases that will be run by this test.

public count() : int
Return values
int

equalTo()

Returns a PHPUnit_Framework_Constraint_IsEqual matcher object.

public static equalTo(mixed $value[, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : PHPUnit_Framework_Constraint_IsEqual
Parameters
$value : mixed
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
since

Method available since Release 3.0.0

Return values
PHPUnit_Framework_Constraint_IsEqual

getCount()

Return the current assertion count.

public static getCount() : int
Tags
since

Method available since Release 3.3.3

Return values
int

getObjectAttribute()

Returns the value of an object's attribute.

public static getObjectAttribute(object $object, string $attributeName) : mixed

This also works for attributes that are declared protected or private.

Parameters
$object : object
$attributeName : string
Tags
throws
PHPUnit_Framework_Exception
since

Method available since Release 4.0.0

Return values
mixed

getStaticAttribute()

Returns the value of a static attribute.

public static getStaticAttribute(string $className, string $attributeName) : mixed

This also works for attributes that are declared protected or private.

Parameters
$className : string
$attributeName : string
Tags
throws
PHPUnit_Framework_Exception
since

Method available since Release 4.0.0

Return values
mixed

greaterThanOrEqual()

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object.

public static greaterThanOrEqual(mixed $value) : PHPUnit_Framework_Constraint_Or
Parameters
$value : mixed
Tags
since

Method available since Release 3.1.0

Return values
PHPUnit_Framework_Constraint_Or

lessThanOrEqual()

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.

public static lessThanOrEqual(mixed $value) : PHPUnit_Framework_Constraint_Or
Parameters
$value : mixed
Tags
since

Method available since Release 3.1.0

Return values
PHPUnit_Framework_Constraint_Or

markTestIncomplete()

Mark the test as incomplete.

public static markTestIncomplete([string $message = '' ]) : mixed
Parameters
$message : string = ''
Tags
throws
PHPUnit_Framework_IncompleteTestError
since

Method available since Release 3.0.0

Return values
mixed

markTestSkipped()

Mark the test as skipped.

public static markTestSkipped([string $message = '' ]) : mixed
Parameters
$message : string = ''
Tags
throws
PHPUnit_Framework_SkippedTestError
since

Method available since Release 3.0.0

Return values
mixed

readAttribute()

Returns the value of an attribute of a class or an object.

public static readAttribute(mixed $classOrObject, string $attributeName) : mixed

This also works for attributes that are declared protected or private.

Parameters
$classOrObject : mixed
$attributeName : string
Tags
throws
PHPUnit_Framework_Exception
Return values
mixed

resetCount()

Reset the assertion counter.

public static resetCount() : mixed
Tags
since

Method available since Release 3.3.3

Return values
mixed

toString()

Returns a string representation of the test.

public toString() : string
Return values
string

Search results