8 use Test::More tests => 28;
11 my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
12 File::Spec->curdir());
13 require $shredder_utils;
16 my @PLUGINS = sort qw(Attachments Base Objects SQLDump Summary Tickets Users);
18 use_ok('RT::Shredder::Plugin');
20 my $plugin = new RT::Shredder::Plugin;
21 isa_ok($plugin, 'RT::Shredder::Plugin');
22 my %plugins = $plugin->List;
23 cmp_deeply( [sort keys %plugins], [@PLUGINS], "correct plugins" );
25 { # test ->List as class method
26 my %plugins = RT::Shredder::Plugin->List;
27 cmp_deeply( [sort keys %plugins], [@PLUGINS], "correct plugins" );
29 { # reblessing on LoadByName
31 my $plugin = new RT::Shredder::Plugin;
32 isa_ok($plugin, 'RT::Shredder::Plugin');
33 my ($status, $msg) = $plugin->LoadByName( $_ );
34 ok($status, "loaded plugin by name") or diag("error: $msg");
35 isa_ok($plugin, "RT::Shredder::Plugin::$_" );
38 { # error checking in LoadByName
39 my $plugin = new RT::Shredder::Plugin;
40 isa_ok($plugin, 'RT::Shredder::Plugin');
41 my ($status, $msg) = $plugin->LoadByName;
42 ok(!$status, "not loaded plugin - empty name");
43 ($status, $msg) = $plugin->LoadByName('Foo');
44 ok(!$status, "not loaded plugin - not exist");