[Rt-commit] rt branch, 4.4/fix-shredder-scrip-removal, updated. rt-4.4.4-48-g071f793bb

Blaine Motsinger blaine at bestpractical.com
Wed Oct 23 15:04:06 EDT 2019


The branch, 4.4/fix-shredder-scrip-removal has been updated
       via  071f793bb340aaead7a673e24106b482a85da672 (commit)
      from  829ae0bf3a1111f1a98d813f6c53a0b98e3c5360 (commit)

Summary of changes:
 t/shredder/02queue.t | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 071f793bb340aaead7a673e24106b482a85da672
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed Oct 23 14:03:07 2019 -0500

    Add tests for shredding queue with custom fields

diff --git a/t/shredder/02queue.t b/t/shredder/02queue.t
index 1055d20a4..86ace446f 100644
--- a/t/shredder/02queue.t
+++ b/t/shredder/02queue.t
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 
 use Test::Deep;
-use RT::Test::Shredder tests => 21;
+use RT::Test::Shredder tests => 26;
 my $test = "RT::Test::Shredder";
 
 diag 'simple queue' if $ENV{TEST_VERBOSE};
@@ -126,3 +126,40 @@ diag 'queue with a watcher' if $ENV{TEST_VERBOSE};
 #    $shredder->WipeoutAll;
 #    cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
 }
+
+diag 'queue with custom fields' if $ENV{TEST_VERBOSE};
+{
+    my $ticket_custom_field = RT::CustomField->new( RT->SystemUser );
+    my ($id, $msg) = $ticket_custom_field->Create(
+        Name => 'ticket custom field',
+        Type => 'Freeform',
+        LookupType => RT::Ticket->CustomFieldLookupType,
+        MaxValues => '1',
+    );
+    ok($id, 'created ticket custom field') or diag "error: $msg";
+
+    my $transaction_custom_field = RT::CustomField->new( RT->SystemUser );
+    ($id, $msg) = $transaction_custom_field->Create(
+        Name => 'transaction custom field',
+        Type => 'Freeform',
+        LookupType => RT::Transaction->CustomFieldLookupType,
+        MaxValues => '1',
+    );
+    ok($id, 'created transaction custom field') or diag "error: $msg";
+
+    $test->create_savepoint('clean');
+    my $queue = RT::Queue->new( RT->SystemUser );
+    ($id, $msg) = $queue->Create( Name => 'my queue' );
+    ok($id, 'created queue') or diag "error: $msg";
+
+    # apply the custom fields to the queue.
+    $ticket_custom_field->AddToObject( $queue );
+    $transaction_custom_field->AddToObject( $queue );
+
+    my $shredder = $test->shredder_new();
+    $shredder->PutObjects( Objects => $queue );
+    $shredder->WipeoutAll;
+    $test->db_is_valid;
+
+    cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+}

-----------------------------------------------------------------------


More information about the rt-commit mailing list