Files
pest/tests/Features/Expect/toBeWritableDirectory.php
2022-09-19 09:03:27 +02:00

20 lines
611 B
PHP

<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(sys_get_temp_dir())->toBeWritableDirectory();
});
test('failures', function () {
expect('/random/path/whatever')->toBeWritableDirectory();
})->throws(ExpectationFailedException::class);
test('failures with custom message', function () {
expect('/random/path/whatever')->toBeWritableDirectory('oh no!');
})->throws(ExpectationFailedException::class, 'oh no!');
test('not failures', function () {
expect(sys_get_temp_dir())->not->toBeWritableDirectory();
})->throws(ExpectationFailedException::class);