fix: assertions on opposite expectations

This commit is contained in:
Nuno Maduro
2023-02-18 15:27:25 +00:00
parent 05989c35a7
commit f309e06292
3 changed files with 6 additions and 2 deletions

View File

@ -865,6 +865,8 @@ final class Expectation
} catch (Throwable $e) {
if (! class_exists($exception)) {
if ($e instanceof Error && $e->getMessage() === "Class \"$exception\" not found") {
Assert::assertTrue(true);
throw $e;
}
@ -883,6 +885,8 @@ final class Expectation
return $this;
}
Assert::assertTrue(true);
if (! class_exists($exception)) {
throw new ExpectationFailedException("Exception with message \"$exception\" not thrown.");
}

View File

@ -917,4 +917,4 @@
PASS Tests\Visual\Version
✓ visual snapshot of help command output
Tests: 4 incomplete, 4 todos, 18 skipped, 634 passed (1554 assertions)
Tests: 4 incomplete, 4 todos, 18 skipped, 634 passed (1559 assertions)

View File

@ -13,6 +13,6 @@ $run = function () {
};
test('parallel', function () use ($run) {
expect($run())->toContain('Tests: 4 incomplete, 4 todos, 15 skipped, 626 passed (1545 assertions)')
expect($run())->toContain('Tests: 4 incomplete, 4 todos, 15 skipped, 626 passed (1550 assertions)')
->toContain('Parallel: 3 processes');
});