Fix bug, I think
[catagits/Catalyst-Plugin-Cache.git] / t / config_backend_class.t
CommitLineData
23b2d59b 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
1049fa80 6use Test::More;
23b2d59b 7
1049fa80 8use_ok "Catalyst::Plugin::Cache";
23b2d59b 9
10{
11 package MockApp;
12 use base qw/Catalyst::Plugin::Cache/;
13
14 package MyCache;
15 sub new {
8429b634 16 my ( $class, $p ) = @_;
22954d19 17 die unless ref $p;
8429b634 18 bless { %$p }, $class;
23b2d59b 19 }
20 sub get {}
21 sub set {}
22 sub remove {}
23}
24
25MockApp->_cache_backends({});
26
27MockApp->setup_generic_cache_backend( "foo", {
28 class => "MyCache",
29 param => "foo",
30});
31
32my $registered = MockApp->get_cache_backend( "foo" );
33
34ok( $registered, "registered a backend" );
35
8429b634 36is_deeply( $registered, MyCache->new({ param => "foo" }), "params sent correctly" );
23b2d59b 37
1049fa80 38done_testing;
39