6 use RT::Test::Shredder nodb => 1, tests => 28;
7 my $test = "RT::Test::Shredder";
9 my @PLUGINS = sort qw(Attachments Base Objects SQLDump Summary Tickets Users);
11 use_ok('RT::Shredder::Plugin');
13 my $plugin = RT::Shredder::Plugin->new;
14 isa_ok($plugin, 'RT::Shredder::Plugin');
15 my %plugins = $plugin->List;
16 cmp_deeply( [sort keys %plugins], [@PLUGINS], "correct plugins" );
18 { # test ->List as class method
19 my %plugins = RT::Shredder::Plugin->List;
20 cmp_deeply( [sort keys %plugins], [@PLUGINS], "correct plugins" );
22 { # reblessing on LoadByName
24 my $plugin = RT::Shredder::Plugin->new;
25 isa_ok($plugin, 'RT::Shredder::Plugin');
26 my ($status, $msg) = $plugin->LoadByName( $_ );
27 ok($status, "loaded plugin by name") or diag("error: $msg");
28 isa_ok($plugin, "RT::Shredder::Plugin::$_" );
31 { # error checking in LoadByName
32 my $plugin = RT::Shredder::Plugin->new;
33 isa_ok($plugin, 'RT::Shredder::Plugin');
34 my ($status, $msg) = $plugin->LoadByName;
35 ok(!$status, "not loaded plugin - empty name");
36 ($status, $msg) = $plugin->LoadByName('Foo');
37 ok(!$status, "not loaded plugin - not exist");