7 use Test::More tests => 28 + 1; # plus one for warnings check
10 my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
11 File::Spec->curdir());
12 require $shredder_utils;
15 my @PLUGINS = sort qw(Attachments Base Objects SQLDump Summary Tickets Users);
17 use_ok('RT::Shredder::Plugin');
19 my $plugin = RT::Shredder::Plugin->new;
20 isa_ok($plugin, 'RT::Shredder::Plugin');
21 my %plugins = $plugin->List;
22 cmp_deeply( [sort keys %plugins], [@PLUGINS], "correct plugins" );
24 { # test ->List as class method
25 my %plugins = RT::Shredder::Plugin->List;
26 cmp_deeply( [sort keys %plugins], [@PLUGINS], "correct plugins" );
28 { # reblessing on LoadByName
30 my $plugin = RT::Shredder::Plugin->new;
31 isa_ok($plugin, 'RT::Shredder::Plugin');
32 my ($status, $msg) = $plugin->LoadByName( $_ );
33 ok($status, "loaded plugin by name") or diag("error: $msg");
34 isa_ok($plugin, "RT::Shredder::Plugin::$_" );
37 { # error checking in LoadByName
38 my $plugin = RT::Shredder::Plugin->new;
39 isa_ok($plugin, 'RT::Shredder::Plugin');
40 my ($status, $msg) = $plugin->LoadByName;
41 ok(!$status, "not loaded plugin - empty name");
42 ($status, $msg) = $plugin->LoadByName('Foo');
43 ok(!$status, "not loaded plugin - not exist");