6 use RT::Test::Shredder tests => 10;
7 my $test = "RT::Test::Shredder";
9 diag 'global template' if $ENV{TEST_VERBOSE};
11 $test->create_savepoint('clean');
12 my $template = RT::Template->new( RT->SystemUser );
13 my ($id, $msg) = $template->Create(
14 Name => 'my template',
15 Content => "\nsome content",
17 ok($id, 'created template') or diag "error: $msg";
19 my $shredder = $test->shredder_new();
20 $shredder->PutObjects( Objects => $template );
21 $shredder->WipeoutAll;
23 cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
26 diag 'local template' if $ENV{TEST_VERBOSE};
28 $test->create_savepoint('clean');
29 my $template = RT::Template->new( RT->SystemUser );
30 my ($id, $msg) = $template->Create(
31 Name => 'my template',
33 Content => "\nsome content",
35 ok($id, 'created template') or diag "error: $msg";
37 my $shredder = $test->shredder_new();
38 $shredder->PutObjects( Objects => $template );
39 $shredder->WipeoutAll;
41 cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
44 diag 'template used in scrip' if $ENV{TEST_VERBOSE};
46 $test->create_savepoint('clean');
47 my $template = RT::Template->new( RT->SystemUser );
48 my ($id, $msg) = $template->Create(
49 Name => 'my template',
51 Content => "\nsome content",
53 ok($id, 'created template') or diag "error: $msg";
55 my $scrip = RT::Scrip->new( RT->SystemUser );
56 ($id, $msg) = $scrip->Create(
57 Description => 'my scrip',
59 ScripCondition => 'On Create',
60 ScripAction => 'Open Tickets',
61 Template => $template->id,
63 ok($id, 'created scrip') or diag "error: $msg";
65 my $shredder = $test->shredder_new();
66 $shredder->PutObjects( Objects => $template );
67 $shredder->WipeoutAll;
69 cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");