fix: risky tests on oposite expectations

This commit is contained in:
Nuno Maduro
2022-11-18 02:24:54 +00:00
committed by GitHub
parent 6a3cc48d6b
commit 9281060ab5

View File

@ -6,6 +6,7 @@ namespace Pest\Expectations;
use Pest\Expectation;
use Pest\Support\Arr;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\ExpectationFailedException;
use SebastianBergmann\Exporter\Exporter;
@ -64,6 +65,8 @@ final class OppositeExpectation
/* @phpstan-ignore-next-line */
$this->original->{$name}(...$arguments);
} catch (ExpectationFailedException) {
Assert::assertTrue(true);
return $this->original;
}
@ -80,6 +83,8 @@ final class OppositeExpectation
try {
$this->original->{$name}; // @phpstan-ignore-line
} catch (ExpectationFailedException) { // @phpstan-ignore-line
Assert::assertTrue(true);
return $this->original;
}