CryptKey tests

This commit is contained in:
Julián Gutiérrez
2016-07-19 17:15:36 +02:00
parent 039537ebe2
commit 065ef5db99
2 changed files with 40 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ class CryptKey
/**
* @param string $key
*
* @throws \RuntimeException
*
* @return string
*/
private function saveKeyToFile($key)
@@ -58,7 +60,9 @@ class CryptKey
$keyPath = sys_get_temp_dir() . '/' . sha1($key) . '.key';
if (!file_exists($keyPath) && !touch($keyPath)) {
// @codeCoverageIgnoreStart
throw new \RuntimeException('"%s" key file could not be created', $keyPath);
// @codeCoverageIgnoreEnd
}
file_put_contents($keyPath, $key);