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