assertDirectoryIsWritable()

assertDirectoryIsWritable() assertDirectoryIsWritable(string $directory[, string $message = '']) Reports an error identified by $message if the directory specified by $directory is not a directory or is not writable. assertDirectoryNotIsWritable() is the inverse of this assertion and takes the same arguments. Example A.13: Usage of assertDirectoryIsWritable() <?php use PHPUnit\Framework\TestCase; class DirectoryIsWritableTest extends TestCase { public function testFailure() {

assertDirectoryIsReadable()

assertDirectoryIsReadable() assertDirectoryIsReadable(string $directory[, string $message = '']) Reports an error identified by $message if the directory specified by $directory is not a directory or is not readable. assertDirectoryNotIsReadable() is the inverse of this assertion and takes the same arguments. Example A.12: Usage of assertDirectoryIsReadable() <?php use PHPUnit\Framework\TestCase; class DirectoryIsReadableTest extends TestCase { public function testFailure() {

assertDirectoryExists()

assertDirectoryExists() assertDirectoryExists(string $directory[, string $message = '']) Reports an error identified by $message if the directory specified by $directory does not exist. assertDirectoryNotExists() is the inverse of this assertion and takes the same arguments. Example A.11: Usage of assertDirectoryExists() <?php use PHPUnit\Framework\TestCase; class DirectoryExistsTest extends TestCase { public function testFailure() { $this->assertDirectoryExists('/path/

assertCount()

assertCount() assertCount($expectedCount, $haystack[, string $message = '']) Reports an error identified by $message if the number of elements in $haystack is not $expectedCount. assertNotCount() is the inverse of this assertion and takes the same arguments. Example A.10: Usage of assertCount() <?php use PHPUnit\Framework\TestCase; class CountTest extends TestCase { public function testFailure() { $this->assertCount(0, ['foo']); } } ?> phpunit CountTest PHPUnit 5

assertContainsOnlyInstancesOf()

assertContainsOnlyInstancesOf() assertContainsOnlyInstancesOf(string $classname, Traversable|array $haystack[, string $message = '']) Reports an error identified by $message if $haystack does not contain only instances of class $classname. Example A.9: Usage of assertContainsOnlyInstancesOf() <?php use PHPUnit\Framework\TestCase; class ContainsOnlyInstancesOfTest extends TestCase { public function testFailure() { $this->assertContainsOnlyInstancesOf( Foo::cl

assertContainsOnly()

assertContainsOnly() assertContainsOnly(string $type, Iterator|array $haystack[, boolean $isNativeType = null, string $message = '']) Reports an error identified by $message if $haystack does not contain only variables of type $type. $isNativeType is a flag used to indicate whether $type is a native PHP type or not. assertNotContainsOnly() is the inverse of this assertion and takes the same arguments. assertAttributeContainsOnly() and assertAttributeNotContainsOnly() are convenience wrappers th

assertContains()

assertContains() assertContains(mixed $needle, Iterator|array $haystack[, string $message = '']) Reports an error identified by $message if $needle is not an element of $haystack. assertNotContains() is the inverse of this assertion and takes the same arguments. assertAttributeContains() and assertAttributeNotContains() are convenience wrappers that use a public, protected, or private attribute of a class or object as the haystack. Example A.5: Usage of assertContains() <?php use PHPUnit\F

assertClassHasStaticAttribute()

assertClassHasStaticAttribute() assertClassHasStaticAttribute(string $attributeName, string $className[, string $message = '']) Reports an error identified by $message if $className::attributeName does not exist. assertClassNotHasStaticAttribute() is the inverse of this assertion and takes the same arguments. Example A.4: Usage of assertClassHasStaticAttribute() <?php use PHPUnit\Framework\TestCase; class ClassHasStaticAttributeTest extends TestCase { public function testFailure()

assertClassHasAttribute()

assertClassHasAttribute() assertClassHasAttribute(string $attributeName, string $className[, string $message = '']) Reports an error identified by $message if $className::attributeName does not exist. assertClassNotHasAttribute() is the inverse of this assertion and takes the same arguments. Example A.2: Usage of assertClassHasAttribute() <?php use PHPUnit\Framework\TestCase; class ClassHasAttributeTest extends TestCase { public function testFailure() { $this->assertCla

assertArraySubset()

assertArraySubset() assertArraySubset(array $subset, array $array[, bool $strict = '', string $message = '']) Reports an error identified by $message if $array does not contains the $subset. $strict is a flag used to compare the identity of objects within arrays. Example A.3: Usage of assertArraySubset() <?php use PHPUnit\Framework\TestCase; class ArraySubsetTest extends TestCase { public function testFailure() { $this->assertArraySubset(['config' => ['key-a', 'key-b