| File: | t/store.t |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | 1 1 1 | 29077 6 54 | use strict; | ||||
| 2 | 1 1 1 | 8 5 33 | use warnings; | ||||
| 3 | |||||||
| 4 | 1 1 1 | 581 134653 9 | use Test::Most; | ||||
| 5 | 1 1 1 | 50495 5963 204 | use Test::MockModule; | ||||
| 6 | |||||||
| 7 | 1 | 206139 | my $store = Test::MockModule->new('Bot::IRC::Store'); | ||||
| 8 | 1 4 | 51 147 | $store->mock( LoadFile => sub { return { stuff => 'things' } } ); | ||||
| 9 | 1 | 65 | $store->mock( DumpFile => sub {} ); | ||||
| 10 | |||||||
| 11 | 1 1 1 | 56 46 111 | use constant MODULE => 'Bot::IRC::Store'; | ||||
| 12 | |||||||
| 13 | 1 1 1 1 1 | 43 1019 83 73 83 | BEGIN { use_ok(MODULE); } | ||||
| 14 | 1 1 1 1 1 | 791 2494 6 5 80 | BEGIN { use_ok('Bot::IRC'); } | ||||
| 15 | |||||||
| 16 | 1 | 47 | ok( MODULE->can('init'), 'init() method exists' ); | ||||
| 17 | |||||||
| 18 | 1 | 449 | my $plugin; | ||||
| 19 | 1 | 14 | my $bot = Bot::IRC->new( connect => { server => 'irc.perl.org' } ); | ||||
| 20 | |||||||
| 21 | 1 1 | 39 85 | lives_ok( sub { $plugin = MODULE->new($bot) }, 'new()' ); | ||||
| 22 | 1 1 | 329 26 | lives_ok( sub { Bot::IRC::Store::init($bot) }, 'init()' ); | ||||
| 23 | |||||||
| 24 | 1 | 302 | ok( $bot->can('store'), 'store() method exists' ); | ||||
| 25 | 1 | 173 | ok( $bot->store->can('set'), 'set() method exists' ); | ||||
| 26 | 1 | 189 | ok( $bot->store->can('get'), 'get() method exists' ); | ||||
| 27 | |||||||
| 28 | 1 1 | 158 29 | lives_ok( sub { $bot->store->set( stuff => 'things' ) }, 'set()' ); | ||||
| 29 | 1 1 | 176 21 | lives_ok( sub { $bot->store->get('stuff') }, 'get()' ); | ||||
| 30 | |||||||
| 31 | 1 | 363 | done_testing; | ||||