mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 02:07:23 +01:00
fix tests
This commit is contained in:
@ -374,11 +374,11 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Asserts that the value is one of the given values.
|
* Asserts that the value is one of the given values.
|
||||||
*
|
*
|
||||||
* @param array<int, int|string> $possibleValues
|
* @param iterable<int|string, mixed> $values
|
||||||
*/
|
*/
|
||||||
public function toBeIn(array $possibleValues): Expectation
|
public function toBeIn(iterable $values): Expectation
|
||||||
{
|
{
|
||||||
Assert::assertContains($this->value, $possibleValues);
|
Assert::assertContains($this->value, $values);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,13 @@ use PHPUnit\Framework\ExpectationFailedException;
|
|||||||
|
|
||||||
test('passes', function () {
|
test('passes', function () {
|
||||||
expect('a')->toBeIn(['a', 'b', 'c']);
|
expect('a')->toBeIn(['a', 'b', 'c']);
|
||||||
|
expect('d')->not->toBeIn(['a', 'b', 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('failures', function () {
|
test('failures', function () {
|
||||||
expect('d')->toBeIn(['a', 'b', 'c']);
|
expect('d')->toBeIn(['a', 'b', 'c']);
|
||||||
})->throws(ExpectationFailedException::class);
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|
||||||
|
test('not failures', function () {
|
||||||
|
expect('a')->not->toBeIn(['a', 'b', 'c']);
|
||||||
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user