3 use Test::More tests => 2;
8 t::lib::Mocks::mock_config('encryption_key', 'my secret passphrase');
10 my $string = 'a string to encrypt';
12 my $crypt = Koha::Encryption->new;
13 my $encrypted_string = $crypt->encrypt_hex($string);
14 is( $crypt->decrypt_hex($encrypted_string), $string, 'Decrypted to original text' );
16 # Check if exception raised when key is empty or missing
17 t::lib::Mocks::mock_config('encryption_key', '');
18 throws_ok { $crypt = Koha::Encryption->new } 'Koha::Exceptions::MissingParameter', 'Exception raised';