summaryrefslogtreecommitdiff
path: root/rt/t/customfields/api.t
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t/customfields/api.t')
-rw-r--r--rt/t/customfields/api.t30
1 files changed, 28 insertions, 2 deletions
diff --git a/rt/t/customfields/api.t b/rt/t/customfields/api.t
index a50ca77..f4551b3 100644
--- a/rt/t/customfields/api.t
+++ b/rt/t/customfields/api.t
@@ -2,7 +2,7 @@
use strict;
use warnings FATAL => 'all';
-use RT::Test nodata => 1, tests => 145;
+use RT::Test nodata => 1, tests => undef;
use Test::Warn;
# Before we get going, ditch all object_cfs; this will remove
@@ -223,6 +223,32 @@ warning_like {
is($load->Id, $global_cf3->Id, "Loading by name gets non-disabled first, even with order swapped");
}
+{
+ my $cf = RT::Test->load_or_create_custom_field(
+ Name => 'HasEntry cache',
+ Type => 'FreeformSingle',
+ Queue => 0,
+ );
+
+ my ( $ret, $msg ) = $ticket->AddCustomFieldValue( Field => $cf, Value => 'foo' );
+ ok( $ret, $msg );
+ is( $ticket->FirstCustomFieldValue( $cf ), 'foo', 'value is foo' );
+ my $ocfvs = $ticket->CustomFieldValues( $cf );
+ ok( $ocfvs->HasEntry( 'foo' ), 'foo is cached in HasEntry' );
+
+ ( $ret, $msg ) = $ticket->AddCustomFieldValue( Field => $cf, Value => 'bar' );
+ ok( $ret, $msg );
+ is( $ticket->FirstCustomFieldValue( $cf ), 'bar', 'value is bar' );
+ ok( !$ocfvs->HasEntry( 'foo' ), 'foo is not cached in HasEntry' );
+ ok( $ocfvs->HasEntry( 'bar' ), 'bar is cached in HasEntry' );
+
+ ( $ret, $msg ) = $ticket->AddCustomFieldValue( Field => $cf, Value => 'foo' );
+ ok( $ret, $msg );
+ is( $ticket->FirstCustomFieldValue( $cf ), 'foo', 'value is foo' );
+ ok( $ocfvs->HasEntry( 'foo' ), 'foo is cached in HasEntry' );
+ ok( !$ocfvs->HasEntry( 'bar' ), 'bar is not cached in HasEntry' );
+}
+
#SKIP: {
# skip "TODO: should we add CF values to objects via CF Name?", 48;
# names are not unique
@@ -230,4 +256,4 @@ warning_like {
# $test_add_delete_cycle->( sub { return $_[0]->Name } );
#}
-
+done_testing;