mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
feat(expect): add more methods
This commit is contained in:
22
tests/Expect/toBeResource.php
Normal file
22
tests/Expect/toBeResource.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
$resource = tmpfile();
|
||||
|
||||
afterAll(function () use ($resource) {
|
||||
fclose($resource);
|
||||
});
|
||||
|
||||
test('pass', function () use ($resource) {
|
||||
expect($resource)->toBeResource();
|
||||
expect(null)->not->toBeResource();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeResource();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () use ($resource) {
|
||||
expect($resource)->not->toBeResource();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
Reference in New Issue
Block a user