Documentation

Assert
in package

AbstractYes
Tags
no-named-arguments

Parameter names are not covered by the backward compatibility promise for PHPUnit

Table of Contents

Properties

$count  : int

Methods

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.
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.
assertDirectoryDoesNotExist()  : void
Asserts that a directory does not exist.
assertDirectoryExists()  : void
Asserts that a directory exists.
assertDirectoryIsNotReadable()  : void
Asserts that a directory exists and is not readable.
assertDirectoryIsNotWritable()  : void
Asserts that a directory exists and is not writable.
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.
assertDoesNotMatchRegularExpression()  : void
Asserts that a string does not match a given regular expression.
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.
assertFileDoesNotExist()  : void
Asserts that a file does not exist.
assertFileEquals()  : void
Asserts that the contents of one file is equal to the contents of another file.
assertFileEqualsCanonicalizing()  : void
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
assertFileEqualsIgnoringCase()  : void
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
assertFileExists()  : void
Asserts that a file exists.
assertFileIsNotReadable()  : void
Asserts that a file exists and is not readable.
assertFileIsNotWritable()  : void
Asserts that a file exists and is not writable.
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.
assertFileNotEqualsCanonicalizing()  : void
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
assertFileNotEqualsIgnoringCase()  : void
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
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.
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.
assertIsClosedResource()  : void
Asserts that a variable is of type resource and is closed.
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.
assertIsNotClosedResource()  : void
Asserts that a variable is not of type resource.
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.
assertIsNotReadable()  : void
Asserts that a file/dir exists and is not readable.
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.
assertIsNotWritable()  : void
Asserts that a file/dir exists and is not writable.
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.
assertMatchesRegularExpression()  : void
Asserts that a string matches a given regular expression.
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.
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.
assertObjectEquals()  : void
assertObjectHasAttribute()  : void
Asserts that an object has a specified attribute.
assertObjectHasProperty()  : void
Asserts that an object has a specified property.
assertObjectNotHasAttribute()  : void
Asserts that an object does not have a specified attribute.
assertObjectNotHasProperty()  : void
Asserts that an object does not have a specified property.
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.
assertStringEqualsFileCanonicalizing()  : void
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
assertStringEqualsFileIgnoringCase()  : void
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
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.
assertStringNotEqualsFileCanonicalizing()  : void
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
assertStringNotEqualsFileIgnoringCase()  : void
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
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.
callback()  : Callback
classHasAttribute()  : ClassHasAttribute
classHasStaticAttribute()  : ClassHasStaticAttribute
containsEqual()  : TraversableContainsEqual
containsIdentical()  : TraversableContainsIdentical
containsOnly()  : TraversableContainsOnly
containsOnlyInstancesOf()  : TraversableContainsOnly
countOf()  : Count
directoryExists()  : DirectoryExists
equalTo()  : IsEqual
equalToCanonicalizing()  : IsEqualCanonicalizing
equalToIgnoringCase()  : IsEqualIgnoringCase
equalToWithDelta()  : IsEqualWithDelta
fail()  : void
Fails a test with the given message.
fileExists()  : FileExists
getCount()  : int
Return the current assertion count.
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
objectEquals()  : ObjectEquals
objectHasAttribute()  : ObjectHasAttribute
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

$count

private static int $count = 0

Methods

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
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

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
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertClassHasAttribute()

Asserts that a class has a specified attribute.

public static assertClassHasAttribute(string $attributeName, string $className[, string $message = '' ]) : void

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

Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertClassHasStaticAttribute()

Asserts that a class has a specified static attribute.

public static assertClassHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : void

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

Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertClassNotHasAttribute()

Asserts that a class does not have a specified attribute.

public static assertClassNotHasAttribute(string $attributeName, string $className[, string $message = '' ]) : void

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

Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertClassNotHasStaticAttribute()

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

public static assertClassNotHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : void

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

Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertContains()

Asserts that a haystack contains a needle.

public static assertContains(mixed $needle, iterable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iterable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertContainsEquals()

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

assertContainsOnly()

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

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

assertContainsOnlyInstancesOf()

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

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

assertCount()

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

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

assertDirectoryDoesNotExist()

Asserts that a directory does not exist.

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

assertDirectoryExists()

Asserts that a directory exists.

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

assertDirectoryIsNotReadable()

Asserts that a directory exists and is not readable.

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

assertDirectoryIsNotWritable()

Asserts that a directory exists and is not writable.

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

assertDirectoryIsReadable()

Asserts that a directory exists and is readable.

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

assertDirectoryIsWritable()

Asserts that a directory exists and is writable.

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

assertDirectoryNotExists()

Asserts that a directory does not exist.

public static assertDirectoryNotExists(string $directory[, string $message = '' ]) : void

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

Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertDirectoryNotIsReadable()

Asserts that a directory exists and is not readable.

public static assertDirectoryNotIsReadable(string $directory[, string $message = '' ]) : void

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

Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertDirectoryNotIsWritable()

Asserts that a directory exists and is not writable.

public static assertDirectoryNotIsWritable(string $directory[, string $message = '' ]) : void

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

Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertDoesNotMatchRegularExpression()

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

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

assertEmpty()

Asserts that a variable is empty.

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

empty $actual

assertEquals()

Asserts that two variables are equal.

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

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

assertEqualXMLStructure()

Asserts that a hierarchy of DOMElements matches.

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

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

Parameters
$expectedElement : DOMElement
$actualElement : DOMElement
$checkAttributes : bool = false
$message : string = ''
Tags
throws
InvalidArgumentException
throws
AssertionFailedError
throws
ExpectationFailedException
codeCoverageIgnore

assertFalse()

Asserts that a condition is false.

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

false $condition

assertFileDoesNotExist()

Asserts that a file does not exist.

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

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

assertFileEqualsCanonicalizing()

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

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

assertFileEqualsIgnoringCase()

Asserts that the contents of one file is equal to the contents of another file (ignoring case).

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

assertFileExists()

Asserts that a file exists.

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

assertFileIsNotReadable()

Asserts that a file exists and is not readable.

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

assertFileIsNotWritable()

Asserts that a file exists and is not writable.

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

assertFileIsReadable()

Asserts that a file exists and is readable.

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

assertFileIsWritable()

Asserts that a file exists and is writable.

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

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

assertFileNotEqualsCanonicalizing()

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

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

assertFileNotEqualsIgnoringCase()

Asserts that the contents of one file is not equal to the contents of another file (ignoring case).

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

assertFileNotExists()

Asserts that a file does not exist.

public static assertFileNotExists(string $filename[, string $message = '' ]) : void

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

Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertFileNotIsReadable()

Asserts that a file exists and is not readable.

public static assertFileNotIsReadable(string $file[, string $message = '' ]) : void

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

Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertFileNotIsWritable()

Asserts that a file exists and is not writable.

public static assertFileNotIsWritable(string $file[, string $message = '' ]) : void

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

Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertFinite()

Asserts that a variable is finite.

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

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

assertInfinite()

Asserts that a variable is infinite.

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

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
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
psalm-template

ExpectedType of object

psalm-param

class-string<ExpectedType> $expected

psalm-assert

=ExpectedType $actual

assertIsArray()

Asserts that a variable is of type array.

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

array $actual

assertIsBool()

Asserts that a variable is of type bool.

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

bool $actual

assertIsCallable()

Asserts that a variable is of type callable.

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

callable $actual

assertIsClosedResource()

Asserts that a variable is of type resource and is closed.

public static assertIsClosedResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

resource $actual

assertIsFloat()

Asserts that a variable is of type float.

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

float $actual

assertIsInt()

Asserts that a variable is of type int.

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

int $actual

assertIsIterable()

Asserts that a variable is of type iterable.

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

iterable $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!array $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!bool $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!callable $actual

assertIsNotClosedResource()

Asserts that a variable is not of type resource.

public static assertIsNotClosedResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!resource $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!float $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!int $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!iterable $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!numeric $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!object $actual

assertIsNotReadable()

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

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

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!resource $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!scalar $actual

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!string $actual

assertIsNotWritable()

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

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

assertIsNumeric()

Asserts that a variable is of type numeric.

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

numeric $actual

assertIsObject()

Asserts that a variable is of type object.

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

object $actual

assertIsReadable()

Asserts that a file/dir is readable.

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

assertIsResource()

Asserts that a variable is of type resource.

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

resource $actual

assertIsScalar()

Asserts that a variable is of type scalar.

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

scalar $actual

assertIsString()

Asserts that a variable is of type string.

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

string $actual

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

assertMatchesRegularExpression()

Asserts that a string matches a given regular expression.

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

assertNan()

Asserts that a variable is nan.

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

assertNotContains()

Asserts that a haystack does not contain a needle.

public static assertNotContains(mixed $needle, iterable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iterable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertNotContainsEquals()

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

assertNotContainsOnly()

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

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

assertNotCount()

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

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

assertNotEmpty()

Asserts that a variable is not empty.

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

!empty $actual

assertNotEquals()

Asserts that two variables are not equal.

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

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

assertNotFalse()

Asserts that a condition is not false.

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

!false $condition

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
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
psalm-template

ExpectedType of object

psalm-param

class-string<ExpectedType> $expected

psalm-assert

!ExpectedType $actual

assertNotIsReadable()

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

public static assertNotIsReadable(string $filename[, string $message = '' ]) : void

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

Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertNotIsWritable()

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

public static assertNotIsWritable(string $filename[, string $message = '' ]) : void

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

Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

assertNotNull()

Asserts that a variable is not null.

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

!null $actual

assertNotRegExp()

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

public static assertNotRegExp(string $pattern, string $string[, string $message = '' ]) : void

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

Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

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
InvalidArgumentException
throws
ExpectationFailedException

assertNotSameSize()

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

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

assertNotTrue()

Asserts that a condition is not true.

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

!true $condition

assertNull()

Asserts that a variable is null.

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

null $actual

assertObjectEquals()

public static assertObjectEquals(object $expected, object $actual[, string $method = 'equals' ][, string $message = '' ]) : void
Parameters
$expected : object
$actual : object
$method : string = 'equals'
$message : string = ''
Tags
throws
ExpectationFailedException

assertObjectHasAttribute()

Asserts that an object has a specified attribute.

public static assertObjectHasAttribute(string $attributeName, object $object[, string $message = '' ]) : void

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

Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertObjectHasProperty()

Asserts that an object has a specified property.

public final static assertObjectHasProperty(string $propertyName, object $object[, string $message = '' ]) : void
Parameters
$propertyName : string
$object : object
$message : string = ''
Tags
throws
ExpectationFailedException

assertObjectNotHasAttribute()

Asserts that an object does not have a specified attribute.

public static assertObjectNotHasAttribute(string $attributeName, object $object[, string $message = '' ]) : void

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

Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

assertObjectNotHasProperty()

Asserts that an object does not have a specified property.

public final static assertObjectNotHasProperty(string $propertyName, object $object[, string $message = '' ]) : void
Parameters
$propertyName : string
$object : object
$message : string = ''
Tags
throws
ExpectationFailedException

assertRegExp()

Asserts that a string matches a given regular expression.

public static assertRegExp(string $pattern, string $string[, string $message = '' ]) : void

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

Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore

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
InvalidArgumentException
throws
ExpectationFailedException
psalm-template

ExpectedType

psalm-param

ExpectedType $expected

psalm-assert

=ExpectedType $actual

assertSameSize()

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

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

assertStringContainsString()

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

assertStringContainsStringIgnoringCase()

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

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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

assertStringEqualsFileCanonicalizing()

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

public static assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException

assertStringEqualsFileIgnoringCase()

Asserts that the contents of a string is equal to the contents of a file (ignoring case).

public static assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

assertStringNotContainsString()

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

assertStringNotContainsStringIgnoringCase()

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

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

assertStringNotEqualsFileCanonicalizing()

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

public static assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException

assertStringNotEqualsFileIgnoringCase()

Asserts that the contents of a string is not equal to the contents of a file (ignoring case).

public static assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException

assertTrue()

Asserts that a condition is true.

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

true $condition

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
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException

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
Exception
throws
InvalidArgumentException
throws
ExpectationFailedException

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
InvalidArgumentException
throws
ExpectationFailedException
throws
Exception

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
InvalidArgumentException
throws
ExpectationFailedException
throws
Exception

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
InvalidArgumentException
throws
ExpectationFailedException
throws
Exception

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
InvalidArgumentException
throws
ExpectationFailedException
throws
Exception

callback()

public static callback(callable $callback) : Callback
Parameters
$callback : callable
Tags
psalm-template

CallbackInput of mixed

psalm-param

callable(CallbackInput $callback): bool $callback

psalm-return

Callback<CallbackInput>

Return values
Callback

classHasAttribute()

public static classHasAttribute(string $attributeName) : ClassHasAttribute

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

Parameters
$attributeName : string
Return values
ClassHasAttribute

countOf()

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

equalTo()

public static equalTo(mixed $value) : IsEqual
Parameters
$value : mixed
Return values
IsEqual

fail()

Fails a test with the given message.

public static fail([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
AssertionFailedError
psalm-return

never-return

getCount()

Return the current assertion count.

public static getCount() : int
Return values
int

greaterThanOrEqual()

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

isType()

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

lessThanOrEqual()

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

markTestIncomplete()

Mark the test as incomplete.

public static markTestIncomplete([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
IncompleteTestError
psalm-return

never-return

markTestSkipped()

Mark the test as skipped.

public static markTestSkipped([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
SkippedTestError
throws
SyntheticSkippedError
psalm-return

never-return

objectEquals()

public static objectEquals(object $object[, string $method = 'equals' ]) : ObjectEquals
Parameters
$object : object
$method : string = 'equals'
Return values
ObjectEquals

objectHasAttribute()

public static objectHasAttribute(mixed $attributeName) : ObjectHasAttribute

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

Parameters
$attributeName : mixed
Return values
ObjectHasAttribute

resetCount()

Reset the assertion counter.

public static resetCount() : void

stringContains()

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

createWarning()

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

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

        
On this page

Search results