Commit | Line | Data |
9985827d |
1 | use strict; |
2 | use warnings; |
3 | |
fa194d25 |
4 | use Test::More tests => 6; |
9985827d |
5 | use Test::Exception; |
6 | |
7 | my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::User") } |
8 | |
9 | { |
10 | package SomeUser; |
11 | use base $m; |
12 | |
13 | sub new { bless {}, shift }; |
14 | |
15 | sub supported_features { |
16 | { |
17 | feature => { |
18 | subfeature => 1, |
19 | unsupported_subfeature => 0, |
20 | }, |
21 | top_level => 1, |
22 | } |
23 | } |
24 | } |
25 | |
26 | my $o = SomeUser->new; |
27 | |
28 | can_ok( $m, "supports" ); |
29 | |
30 | ok( $o->supports("top_level"), "simple top level feature check"); |
31 | ok( $o->supports(qw/feature subfeature/), "traversal"); |
32 | ok( !$o->supports(qw/feature unsupported_subfeature/), "traversal terminating in false"); |
33 | |
34 | lives_ok { |
35 | $o->supports("bad_key"); |
fa194d25 |
36 | } "can check for non existent feature"; |
9985827d |
37 | |
fa194d25 |
38 | #dies_ok { |
39 | # $o->supports(qw/bad_key subfeature/) |
40 | #} "but can't traverse into one"; |
9985827d |
41 | |
42 | |