Files
pest/tests/Expect/toContainOnly.php
2020-07-13 17:27:55 +01:00

18 lines
515 B
PHP

<?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);