From 187086c479a09629b7d180eec513fb7657f4e291 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 18 May 2020 17:02:39 -0700 Subject: rt 4.2.15 --- rt/t/customfields/api.t | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'rt/t/customfields/api.t') 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; -- cgit v1.1