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/to/directory');
}
}
?>
phpunit DirectoryExistsTest PHPUnit 5.6.0 by Sebastian Bergmann and contributors. F Time: 0 seconds, Memory: 4.75Mb There was 1 failure: 1) DirectoryExistsTest::testFailure Failed asserting that directory "/path/to/directory" exists. /home/sb/DirectoryExistsTest.php:6 FAILURES! Tests: 1, Assertions: 1, Failures: 1.
Please login to continue.