mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
28 lines
713 B
PHP
28 lines
713 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\ExpectationFailedException;
|
|
|
|
beforeEach(function () {
|
|
touch($this->tempFile = sys_get_temp_dir().'/fake.file');
|
|
});
|
|
|
|
afterEach(function () {
|
|
unlink($this->tempFile);
|
|
});
|
|
|
|
test('pass', function () {
|
|
expect($this->tempFile)->toBeFile();
|
|
});
|
|
|
|
test('failures', function () {
|
|
expect('/random/path/whatever.file')->toBeFile();
|
|
})->throws(ExpectationFailedException::class);
|
|
|
|
test('failures with custom message', function () {
|
|
expect('/random/path/whatever.file')->toBeFile('oh no!');
|
|
})->throws(ExpectationFailedException::class, 'oh no!');
|
|
|
|
test('not failures', function () {
|
|
expect($this->tempFile)->not->toBeFile();
|
|
})->throws(ExpectationFailedException::class);
|