Added code coverage ignore docblocks

This commit is contained in:
Alex Bilbie 2016-02-12 18:08:27 +00:00
parent de13e14cdd
commit 335630f150
2 changed files with 6 additions and 0 deletions

View File

@ -36,7 +36,9 @@ class KeyCrypt
$chunk = substr($unencryptedData, 0, $chunkSize); $chunk = substr($unencryptedData, 0, $chunkSize);
$unencryptedData = substr($unencryptedData, $chunkSize); $unencryptedData = substr($unencryptedData, $chunkSize);
if (openssl_private_encrypt($chunk, $encrypted, $privateKey) === false) { if (openssl_private_encrypt($chunk, $encrypted, $privateKey) === false) {
// @codeCoverageIgnoreStart
throw new \LogicException('Failed to encrypt data'); throw new \LogicException('Failed to encrypt data');
// @codeCoverageIgnoreEnd
} }
$output .= $encrypted; $output .= $encrypted;
} }
@ -72,7 +74,9 @@ class KeyCrypt
$chunk = substr($encryptedData, 0, $chunkSize); $chunk = substr($encryptedData, 0, $chunkSize);
$encryptedData = substr($encryptedData, $chunkSize); $encryptedData = substr($encryptedData, $chunkSize);
if (openssl_public_decrypt($chunk, $decrypted, $publicKey) === false) { if (openssl_public_decrypt($chunk, $decrypted, $publicKey) === false) {
// @codeCoverageIgnoreStart
throw new \LogicException('Failed to decrypt data'); throw new \LogicException('Failed to decrypt data');
// @codeCoverageIgnoreEnd
} }
$output .= $decrypted; $output .= $decrypted;
} }

View File

@ -31,6 +31,7 @@ class SecureKey
{ {
try { try {
$string = random_bytes($len); $string = random_bytes($len);
// @codeCoverageIgnoreStart
} catch (\TypeError $e) { } catch (\TypeError $e) {
// Well, it's an integer, so this IS unexpected. // Well, it's an integer, so this IS unexpected.
throw OAuthServerException::serverError("An unexpected error has occurred"); throw OAuthServerException::serverError("An unexpected error has occurred");
@ -41,6 +42,7 @@ class SecureKey
// If you get this message, the CSPRNG failed hard. // If you get this message, the CSPRNG failed hard.
throw OAuthServerException::serverError("Could not generate a random string. Is our OS secure?"); throw OAuthServerException::serverError("Could not generate a random string. Is our OS secure?");
} }
// @codeCoverageIgnoreEnd
return bin2hex($string); return bin2hex($string);
} }