Warn if you use old config key or blank config. There is a load of simplification...
[catagits/Catalyst-Plugin-Cache.git] / t / config_guess_backend.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More 'no_plan';
7 use Test::Exception;
8
9 {
10     package ManyStores;
11     use base qw/Catalyst::Plugin::Cache/;
12
13     sub registered_plugins {
14         qw/
15             Bar
16             Cache
17             Cache::Store::Foo
18             Cache::Store::Bar
19             MyApp::Plugin::Cache::Store::Moose
20             Cheese
21         /;
22     }
23
24     package OneStore;
25     use base qw/Catalyst::Plugin::Cache/;
26
27     sub registered_plugins {
28         qw/
29             Aplugin
30             Cache
31             Cache::Store::Foo
32         /
33     }
34
35     package NoStores;
36     use base qw/Catalyst::Plugin::Cache/;
37
38     sub registered_plugins {
39         qw/
40             Bar
41             Cache
42             Lala
43         /
44     }
45 }
46
47 # store guessing
48
49 lives_ok { OneStore->guess_default_cache_store } "can guess if only one plugin";
50 is( OneStore->guess_default_cache_store, "Foo", "guess is right" );
51
52 dies_ok { ManyStores->guess_default_cache_store } "can't guess if many";
53 dies_ok { NoStores->guess_default_cache_store } "can't guess if none";
54
55