1use strict;
2use warnings;
3
4use Test::Deep;
5use RT::Test::Shredder tests => undef;
6my $test = "RT::Test::Shredder";
7
8use_ok('RT::Shredder::Plugin::Objects');
9
10$test->create_savepoint('clean');
11
12diag "Shred a queue whose name contains a hyphen";
13{
14    my $queue = RT::Test->load_or_create_queue( Name => 'it-support' );
15    ok( $queue->id, 'created queue' );
16    my $plugin = RT::Shredder::Plugin::Objects->new;
17    my ( $status, $msg ) = $plugin->TestArgs( Queue => 'it-support' );
18    ok( $status, "plugin arguments are ok" ) or diag "error: $msg";
19
20    my $shredder = $test->shredder_new();
21
22    ( $status, my @objs ) = $plugin->Run;
23    ok( $status, "executed plugin successfully" );
24    is( scalar @objs,   1,            'found one queue' );
25    is( $objs[0]->Name, 'it-support', 'found the queue' );
26
27    $shredder->PutObjects( Objects => [ 'RT::Queue-' . RT->Config->Get('Organization') . '-it-support' ] );
28    $shredder->WipeoutAll;
29
30    cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint" );
31}
32
33done_testing();
34