- \PHPUnit_Framework_Assert
abstract class (none) \ PHPUnit_Framework_Assert
- All known direct subclasses:
- PHPUnit_Extensions_TestDecorator, PHPUnit_Framework_TestCase
A set of assert methods.
Method Summary
Name | Description |
---|---|
anything() | Returns a PHPUnit_Framework_Constraint_IsAnything matcher object. |
arrayHasKey($key) | Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object. |
assertArrayHasKey($key, $array, $message = "") | Asserts that an array has a specified key. |
assertArrayNotHasKey($key, $array, $message = "") | Asserts that an array does not have a specified key. |
assertArraySubset($subset, $array, $strict = false, $message = "") | Asserts that an array has a specified subset. |
assertAttributeContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) | Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle. |
assertAttributeContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $message = "") | 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($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = "") | Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute. |
assertAttributeEmpty($haystackAttributeName, $haystackClassOrObject, $message = "") | Asserts that a static attribute of a class or an attribute of an object is empty. |
assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | Asserts that a variable is equal to an attribute of an object. |
assertAttributeGreaterThan($expected, $actualAttributeName, $actualClassOrObject, $message = "") | Asserts that an attribute is greater than another value. |
assertAttributeGreaterThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = "") | Asserts that an attribute is greater than or equal to another value. |
assertAttributeInstanceOf($expected, $attributeName, $classOrObject, $message = "") | Asserts that an attribute is of a given type. |
assertAttributeInternalType($expected, $attributeName, $classOrObject, $message = "") | Asserts that an attribute is of a given type. |
assertAttributeLessThan($expected, $actualAttributeName, $actualClassOrObject, $message = "") | Asserts that an attribute is smaller than another value. |
assertAttributeLessThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = "") | Asserts that an attribute is smaller than or equal to another value. |
assertAttributeNotContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) | 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($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $message = "") | 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($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = "") | Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute. |
assertAttributeNotEmpty($haystackAttributeName, $haystackClassOrObject, $message = "") | Asserts that a static attribute of a class or an attribute of an object is not empty. |
assertAttributeNotEquals($expected, $actualAttributeName, $actualClassOrObject, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | Asserts that a variable is not equal to an attribute of an object. |
assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message = "") | Asserts that an attribute is of a given type. |
assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message = "") | Asserts that an attribute is of a given type. |
assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject, $message = "") | Asserts that a variable and an attribute of an object do not have the same type and value. |
assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject, $message = "") | Asserts that a variable and an attribute of an object have the same type and value. |
assertClassHasAttribute($attributeName, $className, $message = "") | Asserts that a class has a specified attribute. |
assertClassHasStaticAttribute($attributeName, $className, $message = "") | Asserts that a class has a specified static attribute. |
assertClassNotHasAttribute($attributeName, $className, $message = "") | Asserts that a class does not have a specified attribute. |
assertClassNotHasStaticAttribute($attributeName, $className, $message = "") | Asserts that a class does not have a specified static attribute. |
assertContains($needle, $haystack, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) | Asserts that a haystack contains a needle. |
assertContainsOnly($type, $haystack, $isNativeType = null, $message = "") | Asserts that a haystack contains only values of a given type. |
assertContainsOnlyInstancesOf($classname, $haystack, $message = "") | Asserts that a haystack contains only instances of a given classname |
assertCount($expectedCount, $haystack, $message = "") | Asserts the number of elements of an array, Countable or Traversable. |
assertEmpty($actual, $message = "") | Asserts that a variable is empty. |
assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes = false, $message = "") | Asserts that a hierarchy of DOMElements matches. |
assertEquals($expected, $actual, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | Asserts that two variables are equal. |
assertFalse($condition, $message = "") | Asserts that a condition is false. |
assertFileEquals($expected, $actual, $message = "", $canonicalize = false, $ignoreCase = false) | Asserts that the contents of one file is equal to the contents of another file. |
assertFileExists($filename, $message = "") | Asserts that a file exists. |
assertFileNotEquals($expected, $actual, $message = "", $canonicalize = false, $ignoreCase = false) | Asserts that the contents of one file is not equal to the contents of another file. |
assertFileNotExists($filename, $message = "") | Asserts that a file does not exist. |
assertGreaterThan($expected, $actual, $message = "") | Asserts that a value is greater than another value. |
assertGreaterThanOrEqual($expected, $actual, $message = "") | Asserts that a value is greater than or equal to another value. |
assertInstanceOf($expected, $actual, $message = "") | Asserts that a variable is of a given type. |
assertInternalType($expected, $actual, $message = "") | Asserts that a variable is of a given type. |
assertJson($actualJson, $message = "") | Asserts that a string is a valid JSON string. |
assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = "") | Asserts that two JSON files are equal. |
assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = "") | Asserts that two JSON files are not equal. |
assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = "") | Asserts that the generated JSON encoded object and the content of the given file are equal. |
assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = "") | Asserts that two given JSON encoded objects or arrays are equal. |
assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = "") | Asserts that the generated JSON encoded object and the content of the given file are not equal. |
assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = "") | Asserts that two given JSON encoded objects or arrays are not equal. |
assertLessThan($expected, $actual, $message = "") | Asserts that a value is smaller than another value. |
assertLessThanOrEqual($expected, $actual, $message = "") | Asserts that a value is smaller than or equal to another value. |
assertNotContains($needle, $haystack, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) | Asserts that a haystack does not contain a needle. |
assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = "") | Asserts that a haystack does not contain only values of a given type. |
assertNotCount($expectedCount, $haystack, $message = "") | Asserts the number of elements of an array, Countable or Traversable. |
assertNotEmpty($actual, $message = "") | Asserts that a variable is not empty. |
assertNotEquals($expected, $actual, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | Asserts that two variables are not equal. |
assertNotFalse($condition, $message = "") | Asserts that a condition is not false. |
assertNotInstanceOf($expected, $actual, $message = "") | Asserts that a variable is not of a given type. |
assertNotInternalType($expected, $actual, $message = "") | Asserts that a variable is not of a given type. |
assertNotNull($actual, $message = "") | Asserts that a variable is not null. |
assertNotRegExp($pattern, $string, $message = "") | Asserts that a string does not match a given regular expression. |
assertNotSame($expected, $actual, $message = "") | Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object. |
assertNotSameSize($expected, $actual, $message = "") | Assert that the size of two arrays (or Countable or Traversable objects) is not the same. |
assertNotTag($matcher, $actual, $message = "", $isHtml = true) | This assertion is the exact opposite of assertTag(). |
assertNotTrue($condition, $message = "") | Asserts that a condition is not true. |
assertNull($actual, $message = "") | Asserts that a variable is null. |
assertObjectHasAttribute($attributeName, $object, $message = "") | Asserts that an object has a specified attribute. |
assertObjectNotHasAttribute($attributeName, $object, $message = "") | Asserts that an object does not have a specified attribute. |
assertRegExp($pattern, $string, $message = "") | Asserts that a string matches a given regular expression. |
assertSame($expected, $actual, $message = "") | Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object. |
assertSameSize($expected, $actual, $message = "") | Assert that the size of two arrays (or Countable or Traversable objects) is the same. |
assertSelectCount($selector, $count, $actual, $message = "", $isHtml = true) | Assert the presence, absence, or count of elements in a document matching the CSS $selector, regardless of the contents of those elements. |
assertSelectEquals($selector, $content, $count, $actual, $message = "", $isHtml = true) | assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none? |
assertSelectRegExp($selector, $pattern, $count, $actual, $message = "", $isHtml = true) | assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml); // 3? |
assertStringEndsNotWith($suffix, $string, $message = "") | Asserts that a string ends not with a given suffix. |
assertStringEndsWith($suffix, $string, $message = "") | Asserts that a string ends with a given suffix. |
assertStringEqualsFile($expectedFile, $actualString, $message = "", $canonicalize = false, $ignoreCase = false) | Asserts that the contents of a string is equal to the contents of a file. |
assertStringMatchesFormat($format, $string, $message = "") | Asserts that a string matches a given format string. |
assertStringMatchesFormatFile($formatFile, $string, $message = "") | Asserts that a string matches a given format file. |
assertStringNotEqualsFile($expectedFile, $actualString, $message = "", $canonicalize = false, $ignoreCase = false) | Asserts that the contents of a string is not equal to the contents of a file. |
assertStringNotMatchesFormat($format, $string, $message = "") | Asserts that a string does not match a given format string. |
assertStringNotMatchesFormatFile($formatFile, $string, $message = "") | Asserts that a string does not match a given format string. |
assertStringStartsNotWith($prefix, $string, $message = "") | Asserts that a string starts not with a given prefix. |
assertStringStartsWith($prefix, $string, $message = "") | Asserts that a string starts with a given prefix. |
assertTag($matcher, $actual, $message = "", $isHtml = true) | Evaluate an HTML or XML string and assert its structure and/or contents. |
assertThat($value, PHPUnit_Framework_Constraint $constraint, $message = "") | Evaluates a PHPUnit_Framework_Constraint matcher object. |
assertTrue($condition, $message = "") | Asserts that a condition is true. |
assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = "") | Asserts that two XML files are equal. |
assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = "") | Asserts that two XML files are not equal. |
assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = "") | Asserts that two XML documents are equal. |
assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = "") | Asserts that two XML documents are equal. |
assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = "") | Asserts that two XML documents are not equal. |
assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = "") | Asserts that two XML documents are not equal. |
attribute(PHPUnit_Framework_Constraint $constraint, $attributeName) | Returns a PHPUnit_Framework_Constraint_Attribute matcher object. |
attributeEqualTo($attributeName, $value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object. |
callback($callback) | Returns a PHPUnit_Framework_Constraint_Callback matcher object. |
classHasAttribute($attributeName) | Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object. |
classHasStaticAttribute($attributeName) | Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object. |
contains($value, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false) | Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object. |
containsOnly($type) | Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object. |
containsOnlyInstancesOf($classname) | Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object. |
countOf($count) | Returns a PHPUnit_Framework_Constraint_Count matcher object. |
equalTo($value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | Returns a PHPUnit_Framework_Constraint_IsEqual matcher object. |
fail($message = "") | Fails a test with the given message. |
fileExists() | Returns a PHPUnit_Framework_Constraint_FileExists matcher object. |
getCount() | Return the current assertion count. |
getObjectAttribute($object, $attributeName) | Returns the value of an object's attribute. This also works for attributes that are declared protected or private. |
getStaticAttribute($className, $attributeName) | Returns the value of a static attribute. This also works for attributes that are declared protected or private. |
greaterThan($value) | Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object. |
greaterThanOrEqual($value) | Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object. |
identicalTo($value) | Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object. |
isEmpty() | Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object. |
isFalse() | Returns a PHPUnit_Framework_Constraint_IsFalse matcher object. |
isInstanceOf($className) | Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object. |
isJson() | Returns a PHPUnit_Framework_Constraint_IsJson matcher object. |
isNull() | Returns a PHPUnit_Framework_Constraint_IsNull matcher object. |
isTrue() | Returns a PHPUnit_Framework_Constraint_IsTrue matcher object. |
isType($type) | Returns a PHPUnit_Framework_Constraint_IsType matcher object. |
lessThan($value) | Returns a PHPUnit_Framework_Constraint_LessThan matcher object. |
lessThanOrEqual($value) | Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object. |
logicalAnd() | Returns a PHPUnit_Framework_Constraint_And matcher object. |
logicalNot(PHPUnit_Framework_Constraint $constraint) | Returns a PHPUnit_Framework_Constraint_Not matcher object. |
logicalOr() | Returns a PHPUnit_Framework_Constraint_Or matcher object. |
logicalXor() | Returns a PHPUnit_Framework_Constraint_Xor matcher object. |
markTestIncomplete($message = "") | Mark the test as incomplete. |
markTestSkipped($message = "") | Mark the test as skipped. |
matches($string) | Returns a PHPUnit_Framework_Constraint_StringMatches matcher object. |
matchesRegularExpression($pattern) | Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object. |
objectHasAttribute($attributeName) | Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object. |
readAttribute($classOrObject, $attributeName) | Returns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private. |
resetCount() | Reset the assertion counter. |
stringContains($string, $case = true) | Returns a PHPUnit_Framework_Constraint_StringContains matcher object. |
stringEndsWith($suffix) | Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object. |
stringStartsWith($prefix) | Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object. |
public static function anything()
Returns a PHPUnit_Framework_Constraint_IsAnything matcher object.
- Returns:
- PHPUnit_Framework_Constraint_IsAnything
public static function arrayHasKey($key)
Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object.
- Parameters:
mixed
- $key- Returns:
- PHPUnit_Framework_Constraint_ArrayHasKey
public static function assertArrayHasKey($key, $array, $message = "")
Asserts that an array has a specified key.
- Parameters:
mixed
- $keyarray|ArrayAccess
- $arraystring
- $message- Defaults:
message
=""
public static function assertArrayNotHasKey($key, $array, $message = "")
Asserts that an array does not have a specified key.
- Parameters:
mixed
- $keyarray|ArrayAccess
- $arraystring
- $message- Defaults:
message
=""
public static function assertArraySubset($subset, $array, $strict = false, $message = "")
Asserts that an array has a specified subset.
- Parameters:
array|ArrayAccess
- $arrayboolean
- $strict Check for object identitystring
- $message- Defaults:
strict
=false
message
=""
public static function assertAttributeContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
- Parameters:
mixed
- $haystackClassOrObjectstring
- $messageboolean
- $checkForNonObjectIdentity- Defaults:
message
=""
ignoreCase
=false
checkForObjectIdentity
=true
checkForNonObjectIdentity
=false
public static function assertAttributeContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $message = "")
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.
- Parameters:
string
- $messagemixed
- $haystackClassOrObjectboolean
- $isNativeType- Defaults:
isNativeType
=null
message
=""
public static function assertAttributeCount($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = "")
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
- Parameters:
integer
- $expectedCountstring
- $messagemixed
- $haystackClassOrObject- Defaults:
message
=""
public static function assertAttributeEmpty($haystackAttributeName, $haystackClassOrObject, $message = "")
Asserts that a static attribute of a class or an attribute of an object is empty.
- Parameters:
string
- $messagemixed
- $haystackClassOrObject- Defaults:
message
=""
public static function assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
Asserts that a variable is equal to an attribute of an object.
- Parameters:
mixed
- $expectedstring
- $messagefloat
- $deltainteger
- $maxDepthboolean
- $ignoreCase- Defaults:
message
=""
delta
= 0maxDepth
= 10canonicalize
=false
ignoreCase
=false
public static function assertAttributeGreaterThan($expected, $actualAttributeName, $actualClassOrObject, $message = "")
Asserts that an attribute is greater than another value.
- Parameters:
mixed
- $expectedstring
- $message- Defaults:
message
=""
public static function assertAttributeGreaterThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = "")
Asserts that an attribute is greater than or equal to another value.
- Parameters:
mixed
- $expectedstring
- $message- Defaults:
message
=""
public static function assertAttributeInstanceOf($expected, $attributeName, $classOrObject, $message = "")
Asserts that an attribute is of a given type.
- Parameters:
string
- $messagemixed
- $classOrObject- Defaults:
message
=""
public static function assertAttributeInternalType($expected, $attributeName, $classOrObject, $message = "")
Asserts that an attribute is of a given type.
- Parameters:
string
- $messagemixed
- $classOrObject- Defaults:
message
=""
public static function assertAttributeLessThan($expected, $actualAttributeName, $actualClassOrObject, $message = "")
Asserts that an attribute is smaller than another value.
- Parameters:
mixed
- $expectedstring
- $message- Defaults:
message
=""
public static function assertAttributeLessThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = "")
Asserts that an attribute is smaller than or equal to another value.
- Parameters:
mixed
- $expectedstring
- $message- Defaults:
message
=""
public static function assertAttributeNotContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
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.
- Parameters:
mixed
- $haystackClassOrObjectstring
- $messageboolean
- $checkForNonObjectIdentity- Defaults:
message
=""
ignoreCase
=false
checkForObjectIdentity
=true
checkForNonObjectIdentity
=false
public static function assertAttributeNotContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $message = "")
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.
- Parameters:
string
- $messagemixed
- $haystackClassOrObjectboolean
- $isNativeType- Defaults:
isNativeType
=null
message
=""
public static function assertAttributeNotCount($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = "")
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
- Parameters:
integer
- $expectedCountstring
- $messagemixed
- $haystackClassOrObject- Defaults:
message
=""
public static function assertAttributeNotEmpty($haystackAttributeName, $haystackClassOrObject, $message = "")
Asserts that a static attribute of a class or an attribute of an object is not empty.
- Parameters:
string
- $messagemixed
- $haystackClassOrObject- Defaults:
message
=""
public static function assertAttributeNotEquals($expected, $actualAttributeName, $actualClassOrObject, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
Asserts that a variable is not equal to an attribute of an object.
- Parameters:
mixed
- $expectedstring
- $messagefloat
- $deltainteger
- $maxDepthboolean
- $ignoreCase- Defaults:
message
=""
delta
= 0maxDepth
= 10canonicalize
=false
ignoreCase
=false
public static function assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message = "")
Asserts that an attribute is of a given type.
- Parameters:
string
- $messagemixed
- $classOrObject- Defaults:
message
=""
public static function assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message = "")
Asserts that an attribute is of a given type.
- Parameters:
string
- $messagemixed
- $classOrObject- Defaults:
message
=""
public static function assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject, $message = "")
Asserts that a variable and an attribute of an object do not have the same type and value.
- Parameters:
mixed
- $expectedstring
- $messageobject
- $actualClassOrObject- Defaults:
message
=""
public static function assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject, $message = "")
Asserts that a variable and an attribute of an object have the same type and value.
- Parameters:
mixed
- $expectedstring
- $messageobject
- $actualClassOrObject- Defaults:
message
=""
public static function assertClassHasAttribute($attributeName, $className, $message = "")
Asserts that a class has a specified attribute.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertClassHasStaticAttribute($attributeName, $className, $message = "")
Asserts that a class has a specified static attribute.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertClassNotHasAttribute($attributeName, $className, $message = "")
Asserts that a class does not have a specified attribute.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertClassNotHasStaticAttribute($attributeName, $className, $message = "")
Asserts that a class does not have a specified static attribute.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertContains($needle, $haystack, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
Asserts that a haystack contains a needle.
- Parameters:
mixed
- $haystackstring
- $messageboolean
- $checkForNonObjectIdentity- Defaults:
message
=""
ignoreCase
=false
checkForObjectIdentity
=true
checkForNonObjectIdentity
=false
public static function assertContainsOnly($type, $haystack, $isNativeType = null, $message = "")
Asserts that a haystack contains only values of a given type.
- Parameters:
string
- $messagemixed
- $haystackboolean
- $isNativeType- Defaults:
isNativeType
=null
message
=""
public static function assertContainsOnlyInstancesOf($classname, $haystack, $message = "")
Asserts that a haystack contains only instances of a given classname
- Parameters:
string
- $messagearray|Traversable
- $haystack- Defaults:
message
=""
public static function assertCount($expectedCount, $haystack, $message = "")
Asserts the number of elements of an array, Countable or Traversable.
- Parameters:
integer
- $expectedCountmixed
- $haystackstring
- $message- Defaults:
message
=""
public static function assertEmpty($actual, $message = "")
Asserts that a variable is empty.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes = false, $message = "")
Asserts that a hierarchy of DOMElements matches.
- Parameters:
DOMElement
- $actualElementboolean
- $checkAttributesstring
- $message- Defaults:
checkAttributes
=false
message
=""
public static function assertEquals($expected, $actual, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
Asserts that two variables are equal.
- Parameters:
mixed
- $actualstring
- $messagefloat
- $deltainteger
- $maxDepthboolean
- $ignoreCase- Defaults:
message
=""
delta
= 0maxDepth
= 10canonicalize
=false
ignoreCase
=false
public static function assertFalse($condition, $message = "")
Asserts that a condition is false.
- Parameters:
boolean
- $conditionstring
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function assertFileEquals($expected, $actual, $message = "", $canonicalize = false, $ignoreCase = false)
Asserts that the contents of one file is equal to the contents of another file.
- Parameters:
string
- $messageboolean
- $ignoreCase- Defaults:
message
=""
canonicalize
=false
ignoreCase
=false
public static function assertFileExists($filename, $message = "")
Asserts that a file exists.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertFileNotEquals($expected, $actual, $message = "", $canonicalize = false, $ignoreCase = false)
Asserts that the contents of one file is not equal to the contents of another file.
- Parameters:
string
- $messageboolean
- $ignoreCase- Defaults:
message
=""
canonicalize
=false
ignoreCase
=false
public static function assertFileNotExists($filename, $message = "")
Asserts that a file does not exist.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertGreaterThan($expected, $actual, $message = "")
Asserts that a value is greater than another value.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertGreaterThanOrEqual($expected, $actual, $message = "")
Asserts that a value is greater than or equal to another value.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertInstanceOf($expected, $actual, $message = "")
Asserts that a variable is of a given type.
- Parameters:
string
- $messagemixed
- $actual- Defaults:
message
=""
public static function assertInternalType($expected, $actual, $message = "")
Asserts that a variable is of a given type.
- Parameters:
string
- $messagemixed
- $actual- Defaults:
message
=""
public static function assertJson($actualJson, $message = "")
Asserts that a string is a valid JSON string.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = "")
Asserts that two JSON files are equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = "")
Asserts that two JSON files are not equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = "")
Asserts that the generated JSON encoded object and the content of the given file are equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = "")
Asserts that two given JSON encoded objects or arrays are equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = "")
Asserts that the generated JSON encoded object and the content of the given file are not equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = "")
Asserts that two given JSON encoded objects or arrays are not equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertLessThan($expected, $actual, $message = "")
Asserts that a value is smaller than another value.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertLessThanOrEqual($expected, $actual, $message = "")
Asserts that a value is smaller than or equal to another value.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertNotContains($needle, $haystack, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
Asserts that a haystack does not contain a needle.
- Parameters:
mixed
- $haystackstring
- $messageboolean
- $checkForNonObjectIdentity- Defaults:
message
=""
ignoreCase
=false
checkForObjectIdentity
=true
checkForNonObjectIdentity
=false
public static function assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = "")
Asserts that a haystack does not contain only values of a given type.
- Parameters:
string
- $messagemixed
- $haystackboolean
- $isNativeType- Defaults:
isNativeType
=null
message
=""
public static function assertNotCount($expectedCount, $haystack, $message = "")
Asserts the number of elements of an array, Countable or Traversable.
- Parameters:
integer
- $expectedCountmixed
- $haystackstring
- $message- Defaults:
message
=""
public static function assertNotEmpty($actual, $message = "")
Asserts that a variable is not empty.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function assertNotEquals($expected, $actual, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
Asserts that two variables are not equal.
- Parameters:
mixed
- $actualstring
- $messagefloat
- $deltainteger
- $maxDepthboolean
- $ignoreCase- Defaults:
message
=""
delta
= 0maxDepth
= 10canonicalize
=false
ignoreCase
=false
public static function assertNotFalse($condition, $message = "")
Asserts that a condition is not false.
- Parameters:
boolean
- $conditionstring
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function assertNotInstanceOf($expected, $actual, $message = "")
Asserts that a variable is not of a given type.
- Parameters:
string
- $messagemixed
- $actual- Defaults:
message
=""
public static function assertNotInternalType($expected, $actual, $message = "")
Asserts that a variable is not of a given type.
- Parameters:
string
- $messagemixed
- $actual- Defaults:
message
=""
public static function assertNotNull($actual, $message = "")
Asserts that a variable is not null.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertNotRegExp($pattern, $string, $message = "")
Asserts that a string does not match a given regular expression.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertNotSame($expected, $actual, $message = "")
Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertNotSameSize($expected, $actual, $message = "")
Assert that the size of two arrays (or
Countable
orTraversable
objects) is not the same.
- Parameters:
array|Countable|Traversable
- $actualstring
- $message- Defaults:
message
=""
public static function assertNotTag($matcher, $actual, $message = "", $isHtml = true)
This assertion is the exact opposite of assertTag().
Rather than asserting that $matcher results in a match, it asserts that $matcher does not match.
- Parameters:
array
- $matcherstring
- $messageboolean
- $isHtml- Defaults:
message
=""
isHtml
=true
public static function assertNotTrue($condition, $message = "")
Asserts that a condition is not true.
- Parameters:
boolean
- $conditionstring
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function assertNull($actual, $message = "")
Asserts that a variable is null.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertObjectHasAttribute($attributeName, $object, $message = "")
Asserts that an object has a specified attribute.
- Parameters:
string
- $messageobject
- $object- Defaults:
message
=""
public static function assertObjectNotHasAttribute($attributeName, $object, $message = "")
Asserts that an object does not have a specified attribute.
- Parameters:
string
- $messageobject
- $object- Defaults:
message
=""
public static function assertRegExp($pattern, $string, $message = "")
Asserts that a string matches a given regular expression.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertSame($expected, $actual, $message = "")
Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object.
- Parameters:
mixed
- $actualstring
- $message- Defaults:
message
=""
public static function assertSameSize($expected, $actual, $message = "")
Assert that the size of two arrays (or
Countable
orTraversable
objects) is the same.
- Parameters:
array|Countable|Traversable
- $actualstring
- $message- Defaults:
message
=""
public static function assertSelectCount($selector, $count, $actual, $message = "", $isHtml = true)
Assert the presence, absence, or count of elements in a document matching the CSS $selector, regardless of the contents of those elements.
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:
array
- $selectorinteger|boolean|array
- $countmixed
- $actualstring
- $messageboolean
- $isHtml- Defaults:
message
=""
isHtml
=true
public static function assertSelectEquals($selector, $content, $count, $actual, $message = "", $isHtml = true)
assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?
- Parameters:
array
- $selectorstring
- $messageinteger|boolean|array
- $countmixed
- $actualboolean
- $isHtml- Defaults:
message
=""
isHtml
=true
public static function assertSelectRegExp($selector, $pattern, $count, $actual, $message = "", $isHtml = true)
assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml); // 3?
- Parameters:
array
- $selectorstring
- $messageinteger|boolean|array
- $countmixed
- $actualboolean
- $isHtml- Defaults:
message
=""
isHtml
=true
public static function assertStringEndsNotWith($suffix, $string, $message = "")
Asserts that a string ends not with a given suffix.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringEndsWith($suffix, $string, $message = "")
Asserts that a string ends with a given suffix.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringEqualsFile($expectedFile, $actualString, $message = "", $canonicalize = false, $ignoreCase = false)
Asserts that the contents of a string is equal to the contents of a file.
- Parameters:
string
- $messageboolean
- $ignoreCase- Defaults:
message
=""
canonicalize
=false
ignoreCase
=false
public static function assertStringMatchesFormat($format, $string, $message = "")
Asserts that a string matches a given format string.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringMatchesFormatFile($formatFile, $string, $message = "")
Asserts that a string matches a given format file.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringNotEqualsFile($expectedFile, $actualString, $message = "", $canonicalize = false, $ignoreCase = false)
Asserts that the contents of a string is not equal to the contents of a file.
- Parameters:
string
- $messageboolean
- $ignoreCase- Defaults:
message
=""
canonicalize
=false
ignoreCase
=false
public static function assertStringNotMatchesFormat($format, $string, $message = "")
Asserts that a string does not match a given format string.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringNotMatchesFormatFile($formatFile, $string, $message = "")
Asserts that a string does not match a given format string.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringStartsNotWith($prefix, $string, $message = "")
Asserts that a string starts not with a given prefix.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertStringStartsWith($prefix, $string, $message = "")
Asserts that a string starts with a given prefix.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertTag($matcher, $actual, $message = "", $isHtml = true)
Evaluate an HTML or XML string and assert its structure and/or contents.
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:
array
- $matcherstring
- $messageboolean
- $isHtml- Defaults:
message
=""
isHtml
=true
public static function assertThat($value, PHPUnit_Framework_Constraint $constraint, $message = "")
Evaluates a PHPUnit_Framework_Constraint matcher object.
- Parameters:
mixed
- $valuePHPUnit_Framework_Constraint
- $constraintstring
- $message- Defaults:
message
=""
public static function assertTrue($condition, $message = "")
Asserts that a condition is true.
- Parameters:
boolean
- $conditionstring
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = "")
Asserts that two XML files are equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = "")
Asserts that two XML files are not equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = "")
Asserts that two XML documents are equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = "")
Asserts that two XML documents are equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = "")
Asserts that two XML documents are not equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = "")
Asserts that two XML documents are not equal.
- Parameters:
string
- $message- Defaults:
message
=""
public static function attribute(PHPUnit_Framework_Constraint $constraint, $attributeName)
Returns a PHPUnit_Framework_Constraint_Attribute matcher object.
- Parameters:
PHPUnit_Framework_Constraint
- $constraintstring
- $attributeName- Returns:
- PHPUnit_Framework_Constraint_Attribute
public static function attributeEqualTo($attributeName, $value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object.
- Parameters:
string
- $attributeNamemixed
- $valuefloat
- $deltainteger
- $maxDepthboolean
- $ignoreCase- Defaults:
delta
= 0maxDepth
= 10canonicalize
=false
ignoreCase
=false
- Returns:
- PHPUnit_Framework_Constraint_Attribute
public static function callback($callback)
Returns a PHPUnit_Framework_Constraint_Callback matcher object.
- Parameters:
callable
- $callback- Returns:
- PHPUnit_Framework_Constraint_Callback
public static function classHasAttribute($attributeName)
Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object.
- Parameters:
string
- $attributeName- Returns:
- PHPUnit_Framework_Constraint_ClassHasAttribute
public static function classHasStaticAttribute($attributeName)
Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object.
- Parameters:
string
- $attributeName- Returns:
- PHPUnit_Framework_Constraint_ClassHasStaticAttribute
public static function contains($value, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object.
- Parameters:
mixed
- $valueboolean
- $checkForNonObjectIdentity- Defaults:
checkForObjectIdentity
=true
checkForNonObjectIdentity
=false
- Returns:
- PHPUnit_Framework_Constraint_TraversableContains
public static function containsOnly($type)
Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.
- Parameters:
string
- $type- Returns:
- PHPUnit_Framework_Constraint_TraversableContainsOnly
public static function containsOnlyInstancesOf($classname)
Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.
- Parameters:
string
- $classname- Returns:
- PHPUnit_Framework_Constraint_TraversableContainsOnly
public static function countOf($count)
Returns a PHPUnit_Framework_Constraint_Count matcher object.
- Parameters:
int
- $count- Returns:
- PHPUnit_Framework_Constraint_Count
public static function equalTo($value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
Returns a PHPUnit_Framework_Constraint_IsEqual matcher object.
- Parameters:
mixed
- $valuefloat
- $deltainteger
- $maxDepthboolean
- $ignoreCase- Defaults:
delta
= 0maxDepth
= 10canonicalize
=false
ignoreCase
=false
- Returns:
- PHPUnit_Framework_Constraint_IsEqual
public static function fail($message = "")
Fails a test with the given message.
- Parameters:
string
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_AssertionFailedError
public static function fileExists()
Returns a PHPUnit_Framework_Constraint_FileExists matcher object.
- Returns:
- PHPUnit_Framework_Constraint_FileExists
public static function getCount()
Return the current assertion count.
- Returns:
- integer
public static function getObjectAttribute($object, $attributeName)
Returns the value of an object's attribute. This also works for attributes that are declared protected or private.
- Parameters:
object
- $objectstring
- $attributeName- Returns:
- mixed
- Throws:
- PHPUnit_Framework_Exception
public static function getStaticAttribute($className, $attributeName)
Returns the value of a static attribute. This also works for attributes that are declared protected or private.
- Parameters:
string
- $attributeName- Returns:
- mixed
- Throws:
- PHPUnit_Framework_Exception
public static function greaterThan($value)
Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object.
- Parameters:
mixed
- $value- Returns:
- PHPUnit_Framework_Constraint_GreaterThan
public static function greaterThanOrEqual($value)
Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object.
- Parameters:
mixed
- $value- Returns:
- PHPUnit_Framework_Constraint_Or
public static function identicalTo($value)
Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object.
- Parameters:
mixed
- $value- Returns:
- PHPUnit_Framework_Constraint_IsIdentical
public static function isEmpty()
Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object.
- Returns:
- PHPUnit_Framework_Constraint_IsEmpty
public static function isFalse()
Returns a PHPUnit_Framework_Constraint_IsFalse matcher object.
- Returns:
- PHPUnit_Framework_Constraint_IsFalse
public static function isInstanceOf($className)
Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object.
- Parameters:
string
- $className- Returns:
- PHPUnit_Framework_Constraint_IsInstanceOf
public static function isJson()
Returns a PHPUnit_Framework_Constraint_IsJson matcher object.
- Returns:
- PHPUnit_Framework_Constraint_IsJson
public static function isNull()
Returns a PHPUnit_Framework_Constraint_IsNull matcher object.
- Returns:
- PHPUnit_Framework_Constraint_IsNull
public static function isTrue()
Returns a PHPUnit_Framework_Constraint_IsTrue matcher object.
- Returns:
- PHPUnit_Framework_Constraint_IsTrue
public static function isType($type)
Returns a PHPUnit_Framework_Constraint_IsType matcher object.
- Parameters:
string
- $type- Returns:
- PHPUnit_Framework_Constraint_IsType
public static function lessThan($value)
Returns a PHPUnit_Framework_Constraint_LessThan matcher object.
- Parameters:
mixed
- $value- Returns:
- PHPUnit_Framework_Constraint_LessThan
public static function lessThanOrEqual($value)
Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.
- Parameters:
mixed
- $value- Returns:
- PHPUnit_Framework_Constraint_Or
public static function logicalAnd()
Returns a PHPUnit_Framework_Constraint_And matcher object.
- Returns:
- PHPUnit_Framework_Constraint_And
public static function logicalNot(PHPUnit_Framework_Constraint $constraint)
Returns a PHPUnit_Framework_Constraint_Not matcher object.
- Parameters:
PHPUnit_Framework_Constraint
- $constraint- Returns:
- PHPUnit_Framework_Constraint_Not
public static function logicalOr()
Returns a PHPUnit_Framework_Constraint_Or matcher object.
- Returns:
- PHPUnit_Framework_Constraint_Or
public static function logicalXor()
Returns a PHPUnit_Framework_Constraint_Xor matcher object.
- Returns:
- PHPUnit_Framework_Constraint_Xor
public static function markTestIncomplete($message = "")
Mark the test as incomplete.
- Parameters:
string
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_IncompleteTestError
public static function markTestSkipped($message = "")
Mark the test as skipped.
- Parameters:
string
- $message- Defaults:
message
=""
- Throws:
- PHPUnit_Framework_SkippedTestError
public static function matches($string)
Returns a PHPUnit_Framework_Constraint_StringMatches matcher object.
- Parameters:
string
- $string- Returns:
- PHPUnit_Framework_Constraint_StringMatches
public static function matchesRegularExpression($pattern)
Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object.
- Parameters:
string
- $pattern- Returns:
- PHPUnit_Framework_Constraint_PCREMatch
public static function objectHasAttribute($attributeName)
Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object.
- Parameters:
string
- $attributeName- Returns:
- PHPUnit_Framework_Constraint_ObjectHasAttribute
public static function readAttribute($classOrObject, $attributeName)
Returns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private.
- Parameters:
mixed
- $classOrObjectstring
- $attributeName- Returns:
- mixed
- Throws:
- PHPUnit_Framework_Exception
public static function resetCount()
Reset the assertion counter.
public static function stringContains($string, $case = true)
Returns a PHPUnit_Framework_Constraint_StringContains matcher object.
- Parameters:
string
- $stringboolean
- $case- Defaults:
case
=true
- Returns:
- PHPUnit_Framework_Constraint_StringContains
public static function stringEndsWith($suffix)
Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object.
- Parameters:
mixed
- $suffix- Returns:
- PHPUnit_Framework_Constraint_StringEndsWith
public static function stringStartsWith($prefix)
Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object.
- Parameters:
mixed
- $prefix- Returns:
- PHPUnit_Framework_Constraint_StringStartsWith