Documentation

Assert
in package

A set of assertion methods.

Table of Contents

$count  : int
anything()  : IsAnything
arrayHasKey()  : ArrayHasKey
assertArrayHasKey()  : void
Asserts that an array has a specified key.
assertArrayNotHasKey()  : void
Asserts that an array does not have a specified key.
assertArraySubset()  : void
Asserts that an array has a specified subset.
assertAttributeContains()  : void
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
assertAttributeContainsOnly()  : void
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()  : void
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
assertAttributeEmpty()  : void
Asserts that a static attribute of a class or an attribute of an object is empty.
assertAttributeEquals()  : void
Asserts that a variable is equal to an attribute of an object.
assertAttributeGreaterThan()  : void
Asserts that an attribute is greater than another value.
assertAttributeGreaterThanOrEqual()  : void
Asserts that an attribute is greater than or equal to another value.
assertAttributeInstanceOf()  : void
Asserts that an attribute is of a given type.
assertAttributeInternalType()  : void
Asserts that an attribute is of a given type.
assertAttributeLessThan()  : void
Asserts that an attribute is smaller than another value.
assertAttributeLessThanOrEqual()  : void
Asserts that an attribute is smaller than or equal to another value.
assertAttributeNotContains()  : void
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()  : void
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()  : void
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
assertAttributeNotEmpty()  : void
Asserts that a static attribute of a class or an attribute of an object is not empty.
assertAttributeNotEquals()  : void
Asserts that a variable is not equal to an attribute of an object.
assertAttributeNotInstanceOf()  : void
Asserts that an attribute is of a given type.
assertAttributeNotInternalType()  : void
Asserts that an attribute is of a given type.
assertAttributeNotSame()  : void
Asserts that a variable and an attribute of an object do not have the same type and value.
assertAttributeSame()  : void
Asserts that a variable and an attribute of an object have the same type and value.
assertClassHasAttribute()  : void
Asserts that a class has a specified attribute.
assertClassHasStaticAttribute()  : void
Asserts that a class has a specified static attribute.
assertClassNotHasAttribute()  : void
Asserts that a class does not have a specified attribute.
assertClassNotHasStaticAttribute()  : void
Asserts that a class does not have a specified static attribute.
assertContains()  : void
Asserts that a haystack contains a needle.
assertContainsEquals()  : void
assertContainsOnly()  : void
Asserts that a haystack contains only values of a given type.
assertContainsOnlyInstancesOf()  : void
Asserts that a haystack contains only instances of a given class name.
assertCount()  : void
Asserts the number of elements of an array, Countable or Traversable.
assertDirectoryExists()  : void
Asserts that a directory exists.
assertDirectoryIsReadable()  : void
Asserts that a directory exists and is readable.
assertDirectoryIsWritable()  : void
Asserts that a directory exists and is writable.
assertDirectoryNotExists()  : void
Asserts that a directory does not exist.
assertDirectoryNotIsReadable()  : void
Asserts that a directory exists and is not readable.
assertDirectoryNotIsWritable()  : void
Asserts that a directory exists and is not writable.
assertEmpty()  : void
Asserts that a variable is empty.
assertEquals()  : void
Asserts that two variables are equal.
assertEqualsCanonicalizing()  : void
Asserts that two variables are equal (canonicalizing).
assertEqualsIgnoringCase()  : void
Asserts that two variables are equal (ignoring case).
assertEqualsWithDelta()  : void
Asserts that two variables are equal (with delta).
assertEqualXMLStructure()  : void
Asserts that a hierarchy of DOMElements matches.
assertFalse()  : void
Asserts that a condition is false.
assertFileEquals()  : void
Asserts that the contents of one file is equal to the contents of another file.
assertFileExists()  : void
Asserts that a file exists.
assertFileIsReadable()  : void
Asserts that a file exists and is readable.
assertFileIsWritable()  : void
Asserts that a file exists and is writable.
assertFileNotEquals()  : void
Asserts that the contents of one file is not equal to the contents of another file.
assertFileNotExists()  : void
Asserts that a file does not exist.
assertFileNotIsReadable()  : void
Asserts that a file exists and is not readable.
assertFileNotIsWritable()  : void
Asserts that a file exists and is not writable.
assertFinite()  : void
Asserts that a variable is finite.
assertGreaterThan()  : void
Asserts that a value is greater than another value.
assertGreaterThanOrEqual()  : void
Asserts that a value is greater than or equal to another value.
assertInfinite()  : void
Asserts that a variable is infinite.
assertInstanceOf()  : void
Asserts that a variable is of a given type.
assertInternalType()  : void
Asserts that a variable is of a given type.
assertIsArray()  : void
Asserts that a variable is of type array.
assertIsBool()  : void
Asserts that a variable is of type bool.
assertIsCallable()  : void
Asserts that a variable is of type callable.
assertIsFloat()  : void
Asserts that a variable is of type float.
assertIsInt()  : void
Asserts that a variable is of type int.
assertIsIterable()  : void
Asserts that a variable is of type iterable.
assertIsNotArray()  : void
Asserts that a variable is not of type array.
assertIsNotBool()  : void
Asserts that a variable is not of type bool.
assertIsNotCallable()  : void
Asserts that a variable is not of type callable.
assertIsNotFloat()  : void
Asserts that a variable is not of type float.
assertIsNotInt()  : void
Asserts that a variable is not of type int.
assertIsNotIterable()  : void
Asserts that a variable is not of type iterable.
assertIsNotNumeric()  : void
Asserts that a variable is not of type numeric.
assertIsNotObject()  : void
Asserts that a variable is not of type object.
assertIsNotResource()  : void
Asserts that a variable is not of type resource.
assertIsNotScalar()  : void
Asserts that a variable is not of type scalar.
assertIsNotString()  : void
Asserts that a variable is not of type string.
assertIsNumeric()  : void
Asserts that a variable is of type numeric.
assertIsObject()  : void
Asserts that a variable is of type object.
assertIsReadable()  : void
Asserts that a file/dir is readable.
assertIsResource()  : void
Asserts that a variable is of type resource.
assertIsScalar()  : void
Asserts that a variable is of type scalar.
assertIsString()  : void
Asserts that a variable is of type string.
assertIsWritable()  : void
Asserts that a file/dir exists and is writable.
assertJson()  : void
Asserts that a string is a valid JSON string.
assertJsonFileEqualsJsonFile()  : void
Asserts that two JSON files are equal.
assertJsonFileNotEqualsJsonFile()  : void
Asserts that two JSON files are not equal.
assertJsonStringEqualsJsonFile()  : void
Asserts that the generated JSON encoded object and the content of the given file are equal.
assertJsonStringEqualsJsonString()  : void
Asserts that two given JSON encoded objects or arrays are equal.
assertJsonStringNotEqualsJsonFile()  : void
Asserts that the generated JSON encoded object and the content of the given file are not equal.
assertJsonStringNotEqualsJsonString()  : void
Asserts that two given JSON encoded objects or arrays are not equal.
assertLessThan()  : void
Asserts that a value is smaller than another value.
assertLessThanOrEqual()  : void
Asserts that a value is smaller than or equal to another value.
assertNan()  : void
Asserts that a variable is nan.
assertNotContains()  : void
Asserts that a haystack does not contain a needle.
assertNotContainsEquals()  : void
assertNotContainsOnly()  : void
Asserts that a haystack does not contain only values of a given type.
assertNotCount()  : void
Asserts the number of elements of an array, Countable or Traversable.
assertNotEmpty()  : void
Asserts that a variable is not empty.
assertNotEquals()  : void
Asserts that two variables are not equal.
assertNotEqualsCanonicalizing()  : void
Asserts that two variables are not equal (canonicalizing).
assertNotEqualsIgnoringCase()  : void
Asserts that two variables are not equal (ignoring case).
assertNotEqualsWithDelta()  : void
Asserts that two variables are not equal (with delta).
assertNotFalse()  : void
Asserts that a condition is not false.
assertNotInstanceOf()  : void
Asserts that a variable is not of a given type.
assertNotInternalType()  : void
Asserts that a variable is not of a given type.
assertNotIsReadable()  : void
Asserts that a file/dir exists and is not readable.
assertNotIsWritable()  : void
Asserts that a file/dir exists and is not writable.
assertNotNull()  : void
Asserts that a variable is not null.
assertNotRegExp()  : void
Asserts that a string does not match a given regular expression.
assertNotSame()  : void
Asserts that two variables do not have the same type and value.
assertNotSameSize()  : void
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.
assertNotTrue()  : void
Asserts that a condition is not true.
assertNull()  : void
Asserts that a variable is null.
assertObjectHasAttribute()  : void
Asserts that an object has a specified attribute.
assertObjectNotHasAttribute()  : void
Asserts that an object does not have a specified attribute.
assertRegExp()  : void
Asserts that a string matches a given regular expression.
assertSame()  : void
Asserts that two variables have the same type and value.
assertSameSize()  : void
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.
assertStringContainsString()  : void
assertStringContainsStringIgnoringCase()  : void
assertStringEndsNotWith()  : void
Asserts that a string ends not with a given suffix.
assertStringEndsWith()  : void
Asserts that a string ends with a given suffix.
assertStringEqualsFile()  : void
Asserts that the contents of a string is equal to the contents of a file.
assertStringMatchesFormat()  : void
Asserts that a string matches a given format string.
assertStringMatchesFormatFile()  : void
Asserts that a string matches a given format file.
assertStringNotContainsString()  : void
assertStringNotContainsStringIgnoringCase()  : void
assertStringNotEqualsFile()  : void
Asserts that the contents of a string is not equal to the contents of a file.
assertStringNotMatchesFormat()  : void
Asserts that a string does not match a given format string.
assertStringNotMatchesFormatFile()  : void
Asserts that a string does not match a given format string.
assertStringStartsNotWith()  : void
Asserts that a string starts not with a given prefix.
assertStringStartsWith()  : void
Asserts that a string starts with a given prefix.
assertThat()  : void
Evaluates a PHPUnit\Framework\Constraint matcher object.
assertTrue()  : void
Asserts that a condition is true.
assertXmlFileEqualsXmlFile()  : void
Asserts that two XML files are equal.
assertXmlFileNotEqualsXmlFile()  : void
Asserts that two XML files are not equal.
assertXmlStringEqualsXmlFile()  : void
Asserts that two XML documents are equal.
assertXmlStringEqualsXmlString()  : void
Asserts that two XML documents are equal.
assertXmlStringNotEqualsXmlFile()  : void
Asserts that two XML documents are not equal.
assertXmlStringNotEqualsXmlString()  : void
Asserts that two XML documents are not equal.
attribute()  : Attribute
attributeEqualTo()  : Attribute
callback()  : Callback
classHasAttribute()  : ClassHasAttribute
classHasStaticAttribute()  : ClassHasStaticAttribute
contains()  : TraversableContains
containsOnly()  : TraversableContainsOnly
containsOnlyInstancesOf()  : TraversableContainsOnly
countOf()  : Count
directoryExists()  : DirectoryExists
equalTo()  : IsEqual
fail()  : void
Fails a test with the given message.
fileExists()  : FileExists
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.
greaterThan()  : GreaterThan
greaterThanOrEqual()  : LogicalOr
identicalTo()  : IsIdentical
isEmpty()  : IsEmpty
isFalse()  : IsFalse
isFinite()  : IsFinite
isInfinite()  : IsInfinite
isInstanceOf()  : IsInstanceOf
isJson()  : IsJson
isNan()  : IsNan
isNull()  : IsNull
isReadable()  : IsReadable
isTrue()  : IsTrue
isType()  : IsType
isWritable()  : IsWritable
lessThan()  : LessThan
lessThanOrEqual()  : LogicalOr
logicalAnd()  : LogicalAnd
logicalNot()  : LogicalNot
logicalOr()  : LogicalOr
logicalXor()  : LogicalXor
markTestIncomplete()  : void
Mark the test as incomplete.
markTestSkipped()  : void
Mark the test as skipped.
matches()  : StringMatchesFormatDescription
matchesRegularExpression()  : RegularExpression
objectHasAttribute()  : ObjectHasAttribute
readAttribute()  : mixed
Returns the value of an attribute of a class or an object.
resetCount()  : void
Reset the assertion counter.
stringContains()  : StringContains
stringEndsWith()  : StringEndsWith
stringStartsWith()  : StringStartsWith
createWarning()  : void
detectLocationHint()  : array<string|int, mixed>|null
isValidClassAttributeName()  : bool
isValidObjectAttributeName()  : bool

Properties

Methods

anything()

public static anything() : IsAnything
Return values
IsAnything

arrayHasKey()

public static arrayHasKey(int|string $key) : ArrayHasKey
Parameters
$key : int|string
Return values
ArrayHasKey

assertArrayHasKey()

Asserts that an array has a specified key.

public static assertArrayHasKey(int|string $key, array<string|int, mixed>|ArrayAccess $array[, string $message = '' ]) : void
Parameters
$key : int|string
$array : array<string|int, mixed>|ArrayAccess
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertArrayNotHasKey()

Asserts that an array does not have a specified key.

public static assertArrayNotHasKey(int|string $key, array<string|int, mixed>|ArrayAccess $array[, string $message = '' ]) : void
Parameters
$key : int|string
$array : array<string|int, mixed>|ArrayAccess
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

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 $checkForObjectIdentity = false ][, string $message = '' ]) : void
Parameters
$subset : array<string|int, mixed>|ArrayAccess
$array : array<string|int, mixed>|ArrayAccess
$checkForObjectIdentity : bool = false
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3494

Return values
void

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, object|string $haystackClassOrObject[, string $message = '' ][, bool $ignoreCase = false ][, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : void
Parameters
$needle : mixed
$haystackAttributeName : string
$haystackClassOrObject : object|string
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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, object|string $haystackClassOrObject[, bool $isNativeType = null ][, string $message = '' ]) : void
Parameters
$type : string
$haystackAttributeName : string
$haystackClassOrObject : object|string
$isNativeType : bool = null
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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, object|string $haystackClassOrObject[, string $message = '' ]) : void
Parameters
$expectedCount : int
$haystackAttributeName : string
$haystackClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeEmpty()

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

public static assertAttributeEmpty(string $haystackAttributeName, object|string $haystackClassOrObject[, string $message = '' ]) : void
Parameters
$haystackAttributeName : string
$haystackClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeEquals()

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

public static assertAttributeEquals(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject[, string $message = '' ][, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeGreaterThan()

Asserts that an attribute is greater than another value.

public static assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject[, string $message = '' ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeGreaterThanOrEqual()

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

public static assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject[, string $message = '' ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeInstanceOf()

Asserts that an attribute is of a given type.

public static assertAttributeInstanceOf(string $expected, string $attributeName, object|string $classOrObject[, string $message = '' ]) : void
Parameters
$expected : string
$attributeName : string
$classOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeInternalType()

Asserts that an attribute is of a given type.

public static assertAttributeInternalType(string $expected, string $attributeName, object|string $classOrObject[, string $message = '' ]) : void
Parameters
$expected : string
$attributeName : string
$classOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeLessThan()

Asserts that an attribute is smaller than another value.

public static assertAttributeLessThan(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject[, string $message = '' ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeLessThanOrEqual()

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

public static assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject[, string $message = '' ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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, object|string $haystackClassOrObject[, string $message = '' ][, bool $ignoreCase = false ][, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : void
Parameters
$needle : mixed
$haystackAttributeName : string
$haystackClassOrObject : object|string
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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, object|string $haystackClassOrObject[, bool $isNativeType = null ][, string $message = '' ]) : void
Parameters
$type : string
$haystackAttributeName : string
$haystackClassOrObject : object|string
$isNativeType : bool = null
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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, object|string $haystackClassOrObject[, string $message = '' ]) : void
Parameters
$expectedCount : int
$haystackAttributeName : string
$haystackClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeNotEmpty()

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

public static assertAttributeNotEmpty(string $haystackAttributeName, object|string $haystackClassOrObject[, string $message = '' ]) : void
Parameters
$haystackAttributeName : string
$haystackClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeNotEquals()

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

public static assertAttributeNotEquals(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject[, string $message = '' ][, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeNotInstanceOf()

Asserts that an attribute is of a given type.

public static assertAttributeNotInstanceOf(string $expected, string $attributeName, object|string $classOrObject[, string $message = '' ]) : void
Parameters
$expected : string
$attributeName : string
$classOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertAttributeNotInternalType()

Asserts that an attribute is of a given type.

public static assertAttributeNotInternalType(string $expected, string $attributeName, object|string $classOrObject[, string $message = '' ]) : void
Parameters
$expected : string
$attributeName : string
$classOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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|string $actualClassOrObject[, string $message = '' ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

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|string $actualClassOrObject[, string $message = '' ]) : void
Parameters
$expected : mixed
$actualAttributeName : string
$actualClassOrObject : object|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
ReflectionException
throws
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
void

assertClassHasAttribute()

Asserts that a class has a specified attribute.

public static assertClassHasAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertClassHasStaticAttribute()

Asserts that a class has a specified static attribute.

public static assertClassHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertClassNotHasAttribute()

Asserts that a class does not have a specified attribute.

public static assertClassNotHasAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertClassNotHasStaticAttribute()

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

public static assertClassNotHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

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 ]) : void
Parameters
$needle : mixed
$haystack : mixed
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertContainsEquals()

public static assertContainsEquals(mixed $needle, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iteratable<string|int, mixed>
$message : string = ''
Return values
void

assertContainsOnly()

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

public static assertContainsOnly(string $type, iteratable<string|int, mixed> $haystack[, bool|null $isNativeType = null ][, string $message = '' ]) : void
Parameters
$type : string
$haystack : iteratable<string|int, mixed>
$isNativeType : bool|null = null
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertContainsOnlyInstancesOf()

Asserts that a haystack contains only instances of a given class name.

public static assertContainsOnlyInstancesOf(string $className, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$className : string
$haystack : iteratable<string|int, mixed>
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertCount()

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

public static assertCount(int $expectedCount, Countable|iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$expectedCount : int
$haystack : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertDirectoryExists()

Asserts that a directory exists.

public static assertDirectoryExists(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertDirectoryIsReadable()

Asserts that a directory exists and is readable.

public static assertDirectoryIsReadable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertDirectoryIsWritable()

Asserts that a directory exists and is writable.

public static assertDirectoryIsWritable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertDirectoryNotExists()

Asserts that a directory does not exist.

public static assertDirectoryNotExists(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertDirectoryNotIsReadable()

Asserts that a directory exists and is not readable.

public static assertDirectoryNotIsReadable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertDirectoryNotIsWritable()

Asserts that a directory exists and is not writable.

public static assertDirectoryNotIsWritable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertEmpty()

Asserts that a variable is empty.

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

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 ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertEqualsCanonicalizing()

Asserts that two variables are equal (canonicalizing).

public static assertEqualsCanonicalizing(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertEqualsIgnoringCase()

Asserts that two variables are equal (ignoring case).

public static assertEqualsIgnoringCase(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertEqualsWithDelta()

Asserts that two variables are equal (with delta).

public static assertEqualsWithDelta(mixed $expected, mixed $actual, float $delta[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$delta : float
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertEqualXMLStructure()

Asserts that a hierarchy of DOMElements matches.

public static assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement[, bool $checkAttributes = false ][, string $message = '' ]) : void
Parameters
$expectedElement : DOMElement
$actualElement : DOMElement
$checkAttributes : bool = false
$message : string = ''
Tags
throws
AssertionFailedError
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFalse()

Asserts that a condition is false.

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

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 ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFileExists()

Asserts that a file exists.

public static assertFileExists(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFileIsReadable()

Asserts that a file exists and is readable.

public static assertFileIsReadable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFileIsWritable()

Asserts that a file exists and is writable.

public static assertFileIsWritable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

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 ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFileNotExists()

Asserts that a file does not exist.

public static assertFileNotExists(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFileNotIsReadable()

Asserts that a file exists and is not readable.

public static assertFileNotIsReadable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFileNotIsWritable()

Asserts that a file exists and is not writable.

public static assertFileNotIsWritable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertFinite()

Asserts that a variable is finite.

public static assertFinite(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertGreaterThan()

Asserts that a value is greater than another value.

public static assertGreaterThan(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertGreaterThanOrEqual()

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

public static assertGreaterThanOrEqual(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertInfinite()

Asserts that a variable is infinite.

public static assertInfinite(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertInstanceOf()

Asserts that a variable is of a given type.

public static assertInstanceOf(string $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertInternalType()

Asserts that a variable is of a given type.

public static assertInternalType(string $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3369

codeCoverageIgnore
Return values
void

assertIsArray()

Asserts that a variable is of type array.

public static assertIsArray(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsBool()

Asserts that a variable is of type bool.

public static assertIsBool(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsCallable()

Asserts that a variable is of type callable.

public static assertIsCallable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsFloat()

Asserts that a variable is of type float.

public static assertIsFloat(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsInt()

Asserts that a variable is of type int.

public static assertIsInt(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsIterable()

Asserts that a variable is of type iterable.

public static assertIsIterable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotArray()

Asserts that a variable is not of type array.

public static assertIsNotArray(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotBool()

Asserts that a variable is not of type bool.

public static assertIsNotBool(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotCallable()

Asserts that a variable is not of type callable.

public static assertIsNotCallable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotFloat()

Asserts that a variable is not of type float.

public static assertIsNotFloat(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotInt()

Asserts that a variable is not of type int.

public static assertIsNotInt(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotIterable()

Asserts that a variable is not of type iterable.

public static assertIsNotIterable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotNumeric()

Asserts that a variable is not of type numeric.

public static assertIsNotNumeric(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotObject()

Asserts that a variable is not of type object.

public static assertIsNotObject(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotResource()

Asserts that a variable is not of type resource.

public static assertIsNotResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotScalar()

Asserts that a variable is not of type scalar.

public static assertIsNotScalar(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNotString()

Asserts that a variable is not of type string.

public static assertIsNotString(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsNumeric()

Asserts that a variable is of type numeric.

public static assertIsNumeric(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsObject()

Asserts that a variable is of type object.

public static assertIsObject(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsReadable()

Asserts that a file/dir is readable.

public static assertIsReadable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsResource()

Asserts that a variable is of type resource.

public static assertIsResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsScalar()

Asserts that a variable is of type scalar.

public static assertIsScalar(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsString()

Asserts that a variable is of type string.

public static assertIsString(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertIsWritable()

Asserts that a file/dir exists and is writable.

public static assertIsWritable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertJson()

Asserts that a string is a valid JSON string.

public static assertJson(string $actualJson[, string $message = '' ]) : void
Parameters
$actualJson : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertJsonFileEqualsJsonFile()

Asserts that two JSON files are equal.

public static assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertJsonFileNotEqualsJsonFile()

Asserts that two JSON files are not equal.

public static assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

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 = '' ]) : void
Parameters
$expectedFile : string
$actualJson : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertJsonStringEqualsJsonString()

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

public static assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson[, string $message = '' ]) : void
Parameters
$expectedJson : string
$actualJson : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

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 = '' ]) : void
Parameters
$expectedFile : string
$actualJson : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertJsonStringNotEqualsJsonString()

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

public static assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson[, string $message = '' ]) : void
Parameters
$expectedJson : string
$actualJson : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertLessThan()

Asserts that a value is smaller than another value.

public static assertLessThan(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertLessThanOrEqual()

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

public static assertLessThanOrEqual(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNan()

Asserts that a variable is nan.

public static assertNan(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

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 ]) : void
Parameters
$needle : mixed
$haystack : mixed
$message : string = ''
$ignoreCase : bool = false
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertNotContainsEquals()

public static assertNotContainsEquals(mixed $needle, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iteratable<string|int, mixed>
$message : string = ''
Return values
void

assertNotContainsOnly()

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

public static assertNotContainsOnly(string $type, iteratable<string|int, mixed> $haystack[, bool|null $isNativeType = null ][, string $message = '' ]) : void
Parameters
$type : string
$haystack : iteratable<string|int, mixed>
$isNativeType : bool|null = null
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotCount()

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

public static assertNotCount(int $expectedCount, Countable|iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$expectedCount : int
$haystack : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertNotEmpty()

Asserts that a variable is not empty.

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

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 ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotEqualsCanonicalizing()

Asserts that two variables are not equal (canonicalizing).

public static assertNotEqualsCanonicalizing(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotEqualsIgnoringCase()

Asserts that two variables are not equal (ignoring case).

public static assertNotEqualsIgnoringCase(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotEqualsWithDelta()

Asserts that two variables are not equal (with delta).

public static assertNotEqualsWithDelta(mixed $expected, mixed $actual, float $delta[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$delta : float
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotFalse()

Asserts that a condition is not false.

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

assertNotInstanceOf()

Asserts that a variable is not of a given type.

public static assertNotInstanceOf(string $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertNotInternalType()

Asserts that a variable is not of a given type.

public static assertNotInternalType(string $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3369

codeCoverageIgnore
Return values
void

assertNotIsReadable()

Asserts that a file/dir exists and is not readable.

public static assertNotIsReadable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotIsWritable()

Asserts that a file/dir exists and is not writable.

public static assertNotIsWritable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotNull()

Asserts that a variable is not null.

public static assertNotNull(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotRegExp()

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

public static assertNotRegExp(string $pattern, string $string[, string $message = '' ]) : void
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotSame()

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

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

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

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertNotSameSize()

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

public static assertNotSameSize(Countable|iteratable<string|int, mixed> $expected, Countable|iteratable<string|int, mixed> $actual[, string $message = '' ]) : void
Parameters
$expected : Countable|iteratable<string|int, mixed>
$actual : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertNotTrue()

Asserts that a condition is not true.

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

assertNull()

Asserts that a variable is null.

public static assertNull(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertObjectHasAttribute()

Asserts that an object has a specified attribute.

public static assertObjectHasAttribute(string $attributeName, object $object[, string $message = '' ]) : void
Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertObjectNotHasAttribute()

Asserts that an object does not have a specified attribute.

public static assertObjectNotHasAttribute(string $attributeName, object $object[, string $message = '' ]) : void
Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertRegExp()

Asserts that a string matches a given regular expression.

public static assertRegExp(string $pattern, string $string[, string $message = '' ]) : void
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertSame()

Asserts that two variables have the same type and value.

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

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

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertSameSize()

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

public static assertSameSize(Countable|iteratable<string|int, mixed> $expected, Countable|iteratable<string|int, mixed> $actual[, string $message = '' ]) : void
Parameters
$expected : Countable|iteratable<string|int, mixed>
$actual : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertStringContainsString()

public static assertStringContainsString(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringContainsStringIgnoringCase()

public static assertStringContainsStringIgnoringCase(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringEndsNotWith()

Asserts that a string ends not with a given suffix.

public static assertStringEndsNotWith(string $suffix, string $string[, string $message = '' ]) : void
Parameters
$suffix : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringEndsWith()

Asserts that a string ends with a given suffix.

public static assertStringEndsWith(string $suffix, string $string[, string $message = '' ]) : void
Parameters
$suffix : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

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 ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringMatchesFormat()

Asserts that a string matches a given format string.

public static assertStringMatchesFormat(string $format, string $string[, string $message = '' ]) : void
Parameters
$format : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringMatchesFormatFile()

Asserts that a string matches a given format file.

public static assertStringMatchesFormatFile(string $formatFile, string $string[, string $message = '' ]) : void
Parameters
$formatFile : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringNotContainsString()

public static assertStringNotContainsString(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringNotContainsStringIgnoringCase()

public static assertStringNotContainsStringIgnoringCase(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

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 ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringNotMatchesFormat()

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

public static assertStringNotMatchesFormat(string $format, string $string[, string $message = '' ]) : void
Parameters
$format : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringNotMatchesFormatFile()

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

public static assertStringNotMatchesFormatFile(string $formatFile, string $string[, string $message = '' ]) : void
Parameters
$formatFile : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringStartsNotWith()

Asserts that a string starts not with a given prefix.

public static assertStringStartsNotWith(string $prefix, string $string[, string $message = '' ]) : void
Parameters
$prefix : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertStringStartsWith()

Asserts that a string starts with a given prefix.

public static assertStringStartsWith(string $prefix, string $string[, string $message = '' ]) : void
Parameters
$prefix : string
$string : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertThat()

Evaluates a PHPUnit\Framework\Constraint matcher object.

public static assertThat(mixed $value, Constraint $constraint[, string $message = '' ]) : void
Parameters
$value : mixed
$constraint : Constraint
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
Return values
void

assertTrue()

Asserts that a condition is true.

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

assertXmlFileEqualsXmlFile()

Asserts that two XML files are equal.

public static assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertXmlFileNotEqualsXmlFile()

Asserts that two XML files are not equal.

public static assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertXmlStringEqualsXmlFile()

Asserts that two XML documents are equal.

public static assertXmlStringEqualsXmlFile(string $expectedFile, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertXmlStringEqualsXmlString()

Asserts that two XML documents are equal.

public static assertXmlStringEqualsXmlString(DOMDocument|string $expectedXml, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedXml : DOMDocument|string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertXmlStringNotEqualsXmlFile()

Asserts that two XML documents are not equal.

public static assertXmlStringNotEqualsXmlFile(string $expectedFile, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

assertXmlStringNotEqualsXmlString()

Asserts that two XML documents are not equal.

public static assertXmlStringNotEqualsXmlString(DOMDocument|string $expectedXml, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedXml : DOMDocument|string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
ExpectationFailedException
throws
InvalidArgumentException
throws
Exception
Return values
void

attribute()

public static attribute(Constraint $constraint, string $attributeName) : Attribute
Parameters
$constraint : Constraint
$attributeName : string
Tags
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
Attribute

attributeEqualTo()

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

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
Attribute

callback()

public static callback(callable $callback) : Callback
Parameters
$callback : callable
Return values
Callback

classHasAttribute()

public static classHasAttribute(string $attributeName) : ClassHasAttribute
Parameters
$attributeName : string
Return values
ClassHasAttribute

classHasStaticAttribute()

public static classHasStaticAttribute(string $attributeName) : ClassHasStaticAttribute
Parameters
$attributeName : string
Return values
ClassHasStaticAttribute

contains()

public static contains(mixed $value[, bool $checkForObjectIdentity = true ][, bool $checkForNonObjectIdentity = false ]) : TraversableContains
Parameters
$value : mixed
$checkForObjectIdentity : bool = true
$checkForNonObjectIdentity : bool = false
Return values
TraversableContains

containsOnly()

public static containsOnly(string $type) : TraversableContainsOnly
Parameters
$type : string
Return values
TraversableContainsOnly

containsOnlyInstancesOf()

public static containsOnlyInstancesOf(string $className) : TraversableContainsOnly
Parameters
$className : string
Return values
TraversableContainsOnly

countOf()

public static countOf(int $count) : Count
Parameters
$count : int
Return values
Count

directoryExists()

public static directoryExists() : DirectoryExists
Return values
DirectoryExists

equalTo()

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

fail()

Fails a test with the given message.

public static fail([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
AssertionFailedError
Return values
void

fileExists()

public static fileExists() : FileExists
Return values
FileExists

getCount()

Return the current assertion count.

public static getCount() : int
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
Exception
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
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
Exception
throws
ReflectionException
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
mixed

greaterThan()

public static greaterThan(mixed $value) : GreaterThan
Parameters
$value : mixed
Return values
GreaterThan

greaterThanOrEqual()

public static greaterThanOrEqual(mixed $value) : LogicalOr
Parameters
$value : mixed
Return values
LogicalOr

identicalTo()

public static identicalTo(mixed $value) : IsIdentical
Parameters
$value : mixed
Return values
IsIdentical

isEmpty()

public static isEmpty() : IsEmpty
Return values
IsEmpty

isFalse()

public static isFalse() : IsFalse
Return values
IsFalse

isFinite()

public static isFinite() : IsFinite
Return values
IsFinite

isInfinite()

public static isInfinite() : IsInfinite
Return values
IsInfinite

isInstanceOf()

public static isInstanceOf(string $className) : IsInstanceOf
Parameters
$className : string
Return values
IsInstanceOf

isJson()

public static isJson() : IsJson
Return values
IsJson

isNull()

public static isNull() : IsNull
Return values
IsNull

isReadable()

public static isReadable() : IsReadable
Return values
IsReadable

isTrue()

public static isTrue() : IsTrue
Return values
IsTrue

isType()

public static isType(string $type) : IsType
Parameters
$type : string
Return values
IsType

isWritable()

public static isWritable() : IsWritable
Return values
IsWritable

lessThan()

public static lessThan(mixed $value) : LessThan
Parameters
$value : mixed
Return values
LessThan

lessThanOrEqual()

public static lessThanOrEqual(mixed $value) : LogicalOr
Parameters
$value : mixed
Return values
LogicalOr

logicalAnd()

public static logicalAnd() : LogicalAnd
Tags
throws
Exception
Return values
LogicalAnd

logicalNot()

public static logicalNot(Constraint $constraint) : LogicalNot
Parameters
$constraint : Constraint
Return values
LogicalNot

logicalOr()

public static logicalOr() : LogicalOr
Return values
LogicalOr

logicalXor()

public static logicalXor() : LogicalXor
Return values
LogicalXor

markTestIncomplete()

Mark the test as incomplete.

public static markTestIncomplete([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
IncompleteTestError
Return values
void

markTestSkipped()

Mark the test as skipped.

public static markTestSkipped([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
SkippedTestError
throws
SyntheticSkippedError
Return values
void

matches()

public static matches(string $string) : StringMatchesFormatDescription
Parameters
$string : string
Return values
StringMatchesFormatDescription

matchesRegularExpression()

public static matchesRegularExpression(string $pattern) : RegularExpression
Parameters
$pattern : string
Return values
RegularExpression

objectHasAttribute()

public static objectHasAttribute(mixed $attributeName) : ObjectHasAttribute
Parameters
$attributeName : mixed
Return values
ObjectHasAttribute

readAttribute()

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

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

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

Parameters
$classOrObject : object|string
$attributeName : string
Tags
throws
Exception
throws
ReflectionException
deprecated

https://github.com/sebastianbergmann/phpunit/issues/3338

codeCoverageIgnore
Return values
mixed

resetCount()

Reset the assertion counter.

public static resetCount() : void
Return values
void

stringContains()

public static stringContains(string $string[, bool $case = true ]) : StringContains
Parameters
$string : string
$case : bool = true
Return values
StringContains

stringEndsWith()

public static stringEndsWith(string $suffix) : StringEndsWith
Parameters
$suffix : string
Return values
StringEndsWith

stringStartsWith()

public static stringStartsWith(mixed $prefix) : StringStartsWith
Parameters
$prefix : mixed
Return values
StringStartsWith

createWarning()

private static createWarning(string $warning) : void
Parameters
$warning : string
Tags
codeCoverageIgnore
Return values
void

detectLocationHint()

private static detectLocationHint(string $message) : array<string|int, mixed>|null
Parameters
$message : string
Return values
array<string|int, mixed>|null

isValidClassAttributeName()

private static isValidClassAttributeName(string $attributeName) : bool
Parameters
$attributeName : string
Return values
bool

isValidObjectAttributeName()

private static isValidObjectAttributeName(string $attributeName) : bool
Parameters
$attributeName : string
Return values
bool

Search results