mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2025-01-22 05:11:47 +01:00
[SecureRandom] ignore coverage for entropy exceptions
This commit is contained in:
parent
b36885ecd0
commit
ed747fb5e8
@ -22,6 +22,7 @@ function bytes(int $length): string
|
||||
|
||||
try {
|
||||
return \random_bytes($length);
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (\Exception $e) {
|
||||
$code = $e->getCode();
|
||||
if (Str\is_string($code)) {
|
||||
@ -29,5 +30,6 @@ function bytes(int $length): string
|
||||
}
|
||||
|
||||
throw new Psl\Exception\RuntimeException('Unable to gather sufficient entropy.', $code, $e);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ function int(int $min = Math\INT64_MIN, int $max = Math\INT64_MAX): int
|
||||
|
||||
try {
|
||||
return \random_int($min, $max);
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (\Exception $e) {
|
||||
$code = $e->getCode();
|
||||
if (Str\is_string($code)) {
|
||||
@ -27,5 +28,6 @@ function int(int $min = Math\INT64_MIN, int $max = Math\INT64_MAX): int
|
||||
}
|
||||
|
||||
throw new Psl\Exception\RuntimeException('Unable to gather sufficient entropy.', $code, $e);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user