Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// PHPUnit $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("Age must be positive"); $this->expectExceptionCode(422); createUser(["age" => -1]); // Pest expect(fn() => createUser(["age" => -1])) ->toThrow(InvalidArgumentException::class, "Age must be positive"); // Assert no exception $this->expectNotToPerformAssertions(); createUser(["age" => 25]);
Result
Open