Assert

A set of assertion methods.

Known subclasses

AffiliconApiClient\Tests\ClientTest, PHPUnit\Framework\TestCase
Abstract
Open source code
Methods Summary
public static
# assertArrayHasKey( mixed $key , array|\ArrayAccess $array , string $message = '' )
Asserts that an array has a specified key.
public static
# assertArraySubset( array|\ArrayAccess $subset , array|\ArrayAccess $array , bool $strict = false, string $message = '' )
Asserts that an array has a specified subset.
public static
# assertArrayNotHasKey( mixed $key , array|\ArrayAccess $array , string $message = '' )
Asserts that an array does not have a specified key.
public static
# assertContains( mixed $needle , mixed $haystack , string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false )
Asserts that a haystack contains a needle.
public static
# assertAttributeContains( mixed $needle , string $haystackAttributeName , string|object $haystackClassOrObject , string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false )
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
public static
# assertNotContains( mixed $needle , mixed $haystack , string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false )
Asserts that a haystack does not contain a needle.
public static
# assertAttributeNotContains( mixed $needle , string $haystackAttributeName , string|object $haystackClassOrObject , string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false )
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle.
public static
# assertContainsOnly( string $type , mixed $haystack , bool $isNativeType = NULL, string $message = '' )
Asserts that a haystack contains only values of a given type.
public static
# assertContainsOnlyInstancesOf( string $classname , array|\Traversable $haystack , string $message = '' )
Asserts that a haystack contains only instances of a given classname
public static
# assertAttributeContainsOnly( string $type , string $haystackAttributeName , string|object $haystackClassOrObject , bool $isNativeType = NULL, string $message = '' )
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.
public static
# assertNotContainsOnly( string $type , mixed $haystack , bool $isNativeType = NULL, string $message = '' )
Asserts that a haystack does not contain only values of a given type.
public static
# assertAttributeNotContainsOnly( string $type , string $haystackAttributeName , string|object $haystackClassOrObject , bool $isNativeType = NULL, string $message = '' )
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type.
public static
# assertCount( int $expectedCount , mixed $haystack , string $message = '' )
Asserts the number of elements of an array, Countable or Traversable.
public static
# assertAttributeCount( int $expectedCount , string $haystackAttributeName , string|object $haystackClassOrObject , string $message = '' )
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
public static
# assertNotCount( int $expectedCount , mixed $haystack , string $message = '' )
Asserts the number of elements of an array, Countable or Traversable.
public static
# assertAttributeNotCount( int $expectedCount , string $haystackAttributeName , string|object $haystackClassOrObject , string $message = '' )
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
public static
# assertEquals( mixed $expected , mixed $actual , string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false )
Asserts that two variables are equal.
public static
# assertAttributeEquals( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false )
Asserts that a variable is equal to an attribute of an object.
public static
# assertNotEquals( mixed $expected , mixed $actual , string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false )
Asserts that two variables are not equal.
public static
# assertAttributeNotEquals( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false )
Asserts that a variable is not equal to an attribute of an object.
public static
# assertEmpty( mixed $actual , string $message = '' )
Asserts that a variable is empty.
public static
# assertAttributeEmpty( string $haystackAttributeName , string|object $haystackClassOrObject , string $message = '' )
Asserts that a static attribute of a class or an attribute of an object is empty.
public static
# assertNotEmpty( mixed $actual , string $message = '' )
Asserts that a variable is not empty.
public static
# assertAttributeNotEmpty( string $haystackAttributeName , string|object $haystackClassOrObject , string $message = '' )
Asserts that a static attribute of a class or an attribute of an object is not empty.
public static
# assertGreaterThan( mixed $expected , mixed $actual , string $message = '' )
Asserts that a value is greater than another value.
public static
# assertAttributeGreaterThan( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '' )
Asserts that an attribute is greater than another value.
public static
# assertGreaterThanOrEqual( mixed $expected , mixed $actual , string $message = '' )
Asserts that a value is greater than or equal to another value.
public static
# assertAttributeGreaterThanOrEqual( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '' )
Asserts that an attribute is greater than or equal to another value.
public static
# assertLessThan( mixed $expected , mixed $actual , string $message = '' )
Asserts that a value is smaller than another value.
public static
# assertAttributeLessThan( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '' )
Asserts that an attribute is smaller than another value.
public static
# assertLessThanOrEqual( mixed $expected , mixed $actual , string $message = '' )
Asserts that a value is smaller than or equal to another value.
public static
# assertAttributeLessThanOrEqual( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '' )
Asserts that an attribute is smaller than or equal to another value.
public static
# assertFileEquals( string $expected , string $actual , string $message = '', bool $canonicalize = false, bool $ignoreCase = false )
Asserts that the contents of one file is equal to the contents of another file.
public static
# assertFileNotEquals( string $expected , string $actual , string $message = '', bool $canonicalize = false, bool $ignoreCase = false )
Asserts that the contents of one file is not equal to the contents of another file.
public static
# assertStringEqualsFile( string $expectedFile , string $actualString , string $message = '', bool $canonicalize = false, bool $ignoreCase = false )
Asserts that the contents of a string is equal to the contents of a file.
public static
# assertStringNotEqualsFile( string $expectedFile , string $actualString , string $message = '', bool $canonicalize = false, bool $ignoreCase = false )
Asserts that the contents of a string is not equal to the contents of a file.
public static
# assertIsReadable( string $filename , string $message = '' )
Asserts that a file/dir is readable.
public static
# assertNotIsReadable( string $filename , string $message = '' )
Asserts that a file/dir exists and is not readable.
public static
# assertIsWritable( string $filename , string $message = '' )
Asserts that a file/dir exists and is writable.
public static
# assertNotIsWritable( string $filename , string $message = '' )
Asserts that a file/dir exists and is not writable.
public static
# assertDirectoryExists( string $directory , string $message = '' )
Asserts that a directory exists.
public static
# assertDirectoryNotExists( string $directory , string $message = '' )
Asserts that a directory does not exist.
public static
# assertDirectoryIsReadable( string $directory , string $message = '' )
Asserts that a directory exists and is readable.
public static
# assertDirectoryNotIsReadable( string $directory , string $message = '' )
Asserts that a directory exists and is not readable.
public static
# assertDirectoryIsWritable( string $directory , string $message = '' )
Asserts that a directory exists and is writable.
public static
# assertDirectoryNotIsWritable( string $directory , string $message = '' )
Asserts that a directory exists and is not writable.
public static
# assertFileExists( string $filename , string $message = '' )
Asserts that a file exists.
public static
# assertFileNotExists( string $filename , string $message = '' )
Asserts that a file does not exist.
public static
# assertFileIsReadable( string $file , string $message = '' )
Asserts that a file exists and is readable.
public static
# assertFileNotIsReadable( string $file , string $message = '' )
Asserts that a file exists and is not readable.
public static
# assertFileIsWritable( string $file , string $message = '' )
Asserts that a file exists and is writable.
public static
# assertFileNotIsWritable( string $file , string $message = '' )
Asserts that a file exists and is not writable.
public static
# assertTrue( bool $condition , string $message = '' )
Asserts that a condition is true.
public static
# assertNotTrue( bool $condition , string $message = '' )
Asserts that a condition is not true.
public static
# assertFalse( bool $condition , string $message = '' )
Asserts that a condition is false.
public static
# assertNotFalse( bool $condition , string $message = '' )
Asserts that a condition is not false.
public static
# assertNull( mixed $actual , string $message = '' )
Asserts that a variable is null.
public static
# assertNotNull( mixed $actual , string $message = '' )
Asserts that a variable is not null.
public static
# assertFinite( mixed $actual , string $message = '' )
Asserts that a variable is finite.
public static
# assertInfinite( mixed $actual , string $message = '' )
Asserts that a variable is infinite.
public static
# assertNan( mixed $actual , string $message = '' )
Asserts that a variable is nan.
public static
# assertClassHasAttribute( string $attributeName , string $className , string $message = '' )
Asserts that a class has a specified attribute.
public static
# assertClassNotHasAttribute( string $attributeName , string $className , string $message = '' )
Asserts that a class does not have a specified attribute.
public static
# assertClassHasStaticAttribute( string $attributeName , string $className , string $message = '' )
Asserts that a class has a specified static attribute.
public static
# assertClassNotHasStaticAttribute( string $attributeName , string $className , string $message = '' )
Asserts that a class does not have a specified static attribute.
public static
# assertObjectHasAttribute( string $attributeName , object $object , string $message = '' )
Asserts that an object has a specified attribute.
public static
# assertObjectNotHasAttribute( string $attributeName , object $object , string $message = '' )
Asserts that an object does not have a specified attribute.
public static
# assertSame( mixed $expected , mixed $actual , string $message = '' )
Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object.
public static
# assertAttributeSame( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '' )
Asserts that a variable and an attribute of an object have the same type and value.
public static
# assertNotSame( mixed $expected , mixed $actual , string $message = '' )
Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object.
public static
# assertAttributeNotSame( mixed $expected , string $actualAttributeName , string|object $actualClassOrObject , string $message = '' )
Asserts that a variable and an attribute of an object do not have the same type and value.
public static
# assertInstanceOf( string $expected , mixed $actual , string $message = '' )
Asserts that a variable is of a given type.
public static
# assertAttributeInstanceOf( string $expected , string $attributeName , string|object $classOrObject , string $message = '' )
Asserts that an attribute is of a given type.
public static
# assertNotInstanceOf( string $expected , mixed $actual , string $message = '' )
Asserts that a variable is not of a given type.
public static
# assertAttributeNotInstanceOf( string $expected , string $attributeName , string|object $classOrObject , string $message = '' )
Asserts that an attribute is of a given type.
public static
# assertInternalType( string $expected , mixed $actual , string $message = '' )
Asserts that a variable is of a given type.
public static
# assertAttributeInternalType( string $expected , string $attributeName , string|object $classOrObject , string $message = '' )
Asserts that an attribute is of a given type.
public static
# assertNotInternalType( string $expected , mixed $actual , string $message = '' )
Asserts that a variable is not of a given type.
public static
# assertAttributeNotInternalType( string $expected , string $attributeName , string|object $classOrObject , string $message = '' )
Asserts that an attribute is of a given type.
public static
# assertRegExp( string $pattern , string $string , string $message = '' )
Asserts that a string matches a given regular expression.
public static
# assertNotRegExp( string $pattern , string $string , string $message = '' )
Asserts that a string does not match a given regular expression.
public static
# assertSameSize( array|\Countable|\Traversable $expected , array|\Countable|\Traversable $actual , string $message = '' )
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.
public static
# assertNotSameSize( array|\Countable|\Traversable $expected , array|\Countable|\Traversable $actual , string $message = '' )
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.
public static
# assertStringMatchesFormat( string $format , string $string , string $message = '' )
Asserts that a string matches a given format string.
public static
# assertStringNotMatchesFormat( string $format , string $string , string $message = '' )
Asserts that a string does not match a given format string.
public static
# assertStringMatchesFormatFile( string $formatFile , string $string , string $message = '' )
Asserts that a string matches a given format file.
public static
# assertStringNotMatchesFormatFile( string $formatFile , string $string , string $message = '' )
Asserts that a string does not match a given format string.
public static
# assertStringStartsWith( string $prefix , string $string , string $message = '' )
Asserts that a string starts with a given prefix.
public static
# assertStringStartsNotWith( string $prefix , string $string , string $message = '' )
Asserts that a string starts not with a given prefix.
public static
# assertStringEndsWith( string $suffix , string $string , string $message = '' )
Asserts that a string ends with a given suffix.
public static
# assertStringEndsNotWith( string $suffix , string $string , string $message = '' )
Asserts that a string ends not with a given suffix.
public static
# assertXmlFileEqualsXmlFile( string $expectedFile , string $actualFile , string $message = '' )
Asserts that two XML files are equal.
public static
# assertXmlFileNotEqualsXmlFile( string $expectedFile , string $actualFile , string $message = '' )
Asserts that two XML files are not equal.
public static
# assertXmlStringEqualsXmlFile( string $expectedFile , string|\DOMDocument $actualXml , string $message = '' )
Asserts that two XML documents are equal.
public static
# assertXmlStringNotEqualsXmlFile( string $expectedFile , string|\DOMDocument $actualXml , string $message = '' )
Asserts that two XML documents are not equal.
public static
# assertXmlStringEqualsXmlString( string|\DOMDocument $expectedXml , string|\DOMDocument $actualXml , string $message = '' )
Asserts that two XML documents are equal.
public static
# assertXmlStringNotEqualsXmlString( string|\DOMDocument $expectedXml , string|\DOMDocument $actualXml , string $message = '' )
Asserts that two XML documents are not equal.
public static
# assertEqualXMLStructure( DOMElement $expectedElement , DOMElement $actualElement , bool $checkAttributes = false, string $message = '' )
Asserts that a hierarchy of DOMElements matches.
public static
# assertThat( mixed $value , PHPUnit\Framework\Constraint\Constraint $constraint , string $message = '' )
Evaluates a PHPUnit\Framework\Constraint matcher object.
public static
# assertJson( string $actualJson , string $message = '' )
Asserts that a string is a valid JSON string.
public static
# assertJsonStringEqualsJsonString( string $expectedJson , string $actualJson , string $message = '' )
Asserts that two given JSON encoded objects or arrays are equal.
public static
# assertJsonStringNotEqualsJsonString( string $expectedJson , string $actualJson , string $message = '' )
Asserts that two given JSON encoded objects or arrays are not equal.
public static
# assertJsonStringEqualsJsonFile( string $expectedFile , string $actualJson , string $message = '' )
Asserts that the generated JSON encoded object and the content of the given file are equal.
public static
# assertJsonStringNotEqualsJsonFile( string $expectedFile , string $actualJson , string $message = '' )
Asserts that the generated JSON encoded object and the content of the given file are not equal.
public static
# assertJsonFileEqualsJsonFile( string $expectedFile , string $actualFile , string $message = '' )
Asserts that two JSON files are equal.
public static
# assertJsonFileNotEqualsJsonFile( string $expectedFile , string $actualFile , string $message = '' )
Asserts that two JSON files are not equal.
public static
public static
public static
# logicalNot( PHPUnit\Framework\Constraint\Constraint $constraint )
public static
public static
# anything( )
public static
# isTrue( )
public static
# callback( callable $callback )
public static
# isFalse( )
public static
# isJson( )
public static
# isNull( )
public static
# isFinite( )
public static
public static
# isNan( )
public static
# attribute( PHPUnit\Framework\Constraint\Constraint $constraint , string $attributeName )
public static
# contains( mixed $value , bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false )
public static
# containsOnly( string $type )
public static
# containsOnlyInstancesOf( string $classname )
public static
# arrayHasKey( mixed $key )
public static
# equalTo( mixed $value , float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false )
public static
# attributeEqualTo( string $attributeName , mixed $value , float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false )
public static
# isEmpty( )
public static
public static
public static
public static
public static
# greaterThan( mixed $value )
public static
# greaterThanOrEqual( mixed $value )
public static
# classHasAttribute( string $attributeName )
public static
# classHasStaticAttribute( string $attributeName )
public static
# objectHasAttribute( string $attributeName )
public static
# identicalTo( mixed $value )
public static
# isInstanceOf( string $className )
public static
# isType( string $type )
public static
# lessThan( mixed $value )
public static
# lessThanOrEqual( mixed $value )
public static
# matchesRegularExpression( string $pattern )
public static
# matches( string $string )
public static
# stringStartsWith( mixed $prefix )
public static
# stringContains( string $string , bool $case = true )
public static
# stringEndsWith( mixed $suffix )
public static
# countOf( int $count )
public static
# fail( string $message = '' )
Fails a test with the given message.
public static
# readAttribute( string|object $classOrObject , string $attributeName )
Returns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private.
public static
# getStaticAttribute( string $className , string $attributeName )
Returns the value of a static attribute. This also works for attributes that are declared protected or private.
public static
# getObjectAttribute( object $object , string $attributeName )
Returns the value of an object's attribute. This also works for attributes that are declared protected or private.
public static
# markTestIncomplete( string $message = '' )
Mark the test as incomplete.
public static
# markTestSkipped( string $message = '' )
Mark the test as skipped.
public static
# getCount( )
Return the current assertion count.
public static
# resetCount( )
Reset the assertion counter.