[Rt-commit] rt branch, 4.0/shred-object-custom-fields, created. rt-4.0.23-21-g8e8ae8f
Alex Vandiver
alexmv at bestpractical.com
Thu Apr 9 16:01:59 EDT 2015
The branch, 4.0/shred-object-custom-fields has been created
at 8e8ae8f46736b08a0116c44e854388765ec62b59 (commit)
- Log -----------------------------------------------------------------
commit 6a45267a7dfdc259f66af2ba318bf83182ed935e
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Nov 2 15:18:49 2012 -0700
Failing tests for shredding ObjectCustomFields when a CustomField is shredded
diff --git a/t/shredder/02cfs.t b/t/shredder/02cfs.t
new file mode 100644
index 0000000..60dbbd3
--- /dev/null
+++ b/t/shredder/02cfs.t
@@ -0,0 +1,49 @@
+
+use strict;
+use warnings;
+
+use Test::Deep;
+use File::Spec;
+use Test::More tests => 5 + 1; # plus one for warnings check
+use RT::Test ();
+
+BEGIN {
+ my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
+ File::Spec->curdir());
+ require $shredder_utils;
+}
+init_db();
+create_savepoint('clean');
+
+my $cf = RT::Test->load_or_create_custom_field(
+ Name => "Favorite Color",
+ LookupType => "RT::Queue-RT::Ticket",
+ Type => "FreeformSingle",
+);
+ok $cf->id, "Created ticket CF";
+create_savepoint('clean_with_cf');
+
+diag 'global ticket custom field';
+{
+ my $global_queue = RT::Queue->new(RT->SystemUser);
+ my ($ok, $msg) = $cf->AddToObject($global_queue);
+ ok $ok, "Added ticket CF globally: $msg";
+
+ my $shredder = shredder_new();
+ $shredder->PutObjects( Objects => $cf );
+ $shredder->WipeoutAll;
+ cmp_deeply( dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+}
+
+diag 'queue-specific ticket custom field';
+{
+ restore_savepoint('clean_with_cf');
+ my $general = RT::Test->load_or_create_queue( Name => 'General' );
+ my ($ok, $msg) = $cf->AddToObject($general);
+ ok $ok, "Added ticket CF to General queue: $msg";
+
+ my $shredder = shredder_new();
+ $shredder->PutObjects( Objects => $cf );
+ $shredder->WipeoutAll;
+ cmp_deeply( dump_current_and_savepoint('clean'), "current DB equal to savepoint");
+}
commit 8e8ae8f46736b08a0116c44e854388765ec62b59
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Nov 2 15:22:36 2012 -0700
Shred ObjectCustomFields when shredding a custom field
diff --git a/lib/RT/Shredder/CustomField.pm b/lib/RT/Shredder/CustomField.pm
index a3d542a..18130c4 100644
--- a/lib/RT/Shredder/CustomField.pm
+++ b/lib/RT/Shredder/CustomField.pm
@@ -73,6 +73,11 @@ sub __DependsOn
# Custom field values
push( @$list, $self->Values );
+# Applications of this CF
+ my $applied = RT::ObjectCustomFields->new( $self->CurrentUser );
+ $applied->LimitToCustomField( $self->Id );
+ push @$list, $applied;
+
# Ticket custom field values
my $objs = RT::ObjectCustomFieldValues->new( $self->CurrentUser );
$objs->LimitToCustomField( $self->Id );
-----------------------------------------------------------------------
More information about the rt-commit
mailing list