blob: 425c875d6f38fcd3aeff979b38cd05a402fec424 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
use strictures 2;
use Log::Any::Adapter ('TAP');
use Test::More;
use Test::MockObject;
use Test::Differences;
use App::BorgRestore;
my $db = Test::MockObject->new();
my $app = App::BorgRestore->new_no_defaults({db => $db});
$db->mock('get_archive_names', sub {return [qw(a b c)];});
is($app->cache_contains_data(), 1);
$db->mock('get_archive_names', sub {return [];});
is($app->cache_contains_data(), 0);
$db->mock('get_archive_names', sub {return [qw(a)];});
is($app->cache_contains_data(), 1);
done_testing;
|