mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
feat(expect): add more methods
This commit is contained in:
17
tests/Expect/toContainOnly.php
Normal file
17
tests/Expect/toContainOnly.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect([1, 2, 3])->toContainOnly('int');
|
||||
expect(['hello', 'world'])->toContainOnly('string');
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect([1, 2, '3'])->toContainOnly('string');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect([1, 2, 3])->not->toContainOnly('int');
|
||||
expect(['hello', 'world'])->not->toContainOnly('string');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
Reference in New Issue
Block a user