summaryrefslogtreecommitdiffstats
path: root/t/02-typemap.t
diff options
context:
space:
mode:
Diffstat (limited to 't/02-typemap.t')
-rw-r--r--t/02-typemap.t40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/02-typemap.t b/t/02-typemap.t
new file mode 100644
index 0000000..4bc0cb8
--- /dev/null
+++ b/t/02-typemap.t
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Test::Requires 'Crypt::Rijndael';
+use Test::Requires 'Crypt::CFB';
+use Test::Requires 'DateTime';
+
+use KiokuDB;
+use KiokuDB::Util;
+use KiokuDB::Serializer::Crypt;
+
+my $backend = KiokuDB::Util::dsn_to_backend(
+ 'hash',
+ serializer => KiokuDB::Serializer::Crypt->new(
+ serializer => 'json',
+ crypt_cipher => 'Rijndael',
+ crypt_mode => 'CFB',
+ crypt_key => 'foo',
+ ),
+);
+
+my $d = KiokuDB->new(backend => $backend);
+my $obj = [DateTime->now];
+
+{
+ my $s = $d->new_scope;
+ $d->insert(obj => $obj);
+}
+
+{
+ my $s = $d->new_scope;
+ my $db_obj = $d->lookup('obj');
+ is(ref($db_obj), 'ARRAY', "got array back");
+ isa_ok($db_obj->[0], 'DateTime');
+ is_deeply($db_obj, $obj, "got the right obj");
+}
+
+done_testing;