1--TEST--
2Random: Randomizer: Engines throwing an exception are gracefully handled
3--FILE--
4<?php
5
6use Random\Engine;
7use Random\Randomizer;
8
9final class ThrowingEngine implements Engine
10{
11    public function generate(): string
12    {
13        throw new Exception('Error');
14    }
15}
16
17$randomizer = new Randomizer(new ThrowingEngine());
18
19var_dump($randomizer->getBytes(1));
20
21?>
22--EXPECTF--
23Fatal error: Uncaught Exception: Error in %s:%d
24Stack trace:
25#0 [internal function]: ThrowingEngine->generate()
26#1 %s(%d): Random\Randomizer->getBytes(1)
27#2 {main}
28  thrown in %s on line %d
29