toBeInstanceOf(NotFoundException::class) ->and($exception->getMessage())->toBe("Employee '01155902' not found."); }); it('creates exception from string', function (): void { // GIVEN $id = '01155902'; // WHEN $exception = EmployeeNotFoundException::forEmployee($id); // THEN expect($exception)->toBeInstanceOf(NotFoundException::class) ->and($exception->getMessage())->toBe("Employee '01155902' not found."); }); });