Live app test, Cache::Store::Memory
[catagits/Catalyst-Plugin-Cache.git] / t / basic.t
index ac7dab6..2cc7e1e 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -8,20 +8,16 @@ use Test::Exception;
 
 use ok "Catalyst::Plugin::Cache";
 
+use Catalyst::Plugin::Cache::Backend::Memory;
+
 {
     package MockApp;
     use base qw/Catalyst::Plugin::Cache/;
+    
+    sub registered_plugins {}
 
     my %config;
     sub config { \%config };
-
-    package MemoryCache;
-    use Storable qw/freeze thaw/;
-    
-    sub new { bless {}, shift }
-    sub get { ${thaw($_[0]{$_[1]}) || return} };
-    sub set { $_[0]{$_[1]} = freeze(\$_[2]) };
-    sub delete { delete $_[0]{$_[1]} };
 }
 
 MockApp->setup;
@@ -30,8 +26,8 @@ my $c = bless {}, "MockApp";
 can_ok( $c, "register_cache_backend" );
 can_ok( $c, "unregister_cache_backend" );
 
-MockApp->register_cache_backend( default => MemoryCache->new );
-MockApp->register_cache_backend( moose => MemoryCache->new );
+MockApp->register_cache_backend( default => Catalyst::Plugin::Cache::Backend::Memory->new );
+MockApp->register_cache_backend( moose => Catalyst::Plugin::Cache::Backend::Memory->new );
 
 can_ok( $c, "cache" );
 
@@ -65,15 +61,15 @@ can_ok( $c, "choose_cache_backend" );
 
 can_ok( $c, "cache_set" );
 can_ok( $c, "cache_get" );
-can_ok( $c, "cache_delete" );
+can_ok( $c, "cache_remove" );
 
 $c->cache_set( foo => "bar" );
 is( $c->cache_get("foo"), "bar", "set" );
 
-$c->cache_delete( "foo" );
-is( $c->cache_get("foo"), undef, "delete" );
+$c->cache_remove( "foo" );
+is( $c->cache_get("foo"), undef, "remove" );
 
-MockApp->register_cache_backend( elk => MemoryCache->new );
+MockApp->register_cache_backend( elk => Catalyst::Plugin::Cache::Backend::Memory->new );
 
 is( $c->choose_cache_backend_wrapper( key => "foo" ), $c->default_cache_backend, "choose default" );
 is( $c->choose_cache_backend_wrapper( key => "foo", backend => "elk" ), $c->get_cache_backend("elk"), "override choice" );