X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Ft%2Fcustomfields%2Fapi.t;fp=rt%2Ft%2Fcustomfields%2Fapi.t;h=f4551b363250a0b7fcd52238243a9f989894009e;hp=a50ca770c9d0c8e373dbba036166eb288f2dd403;hb=187086c479a09629b7d180eec513fb7657f4e291;hpb=4639e25a658d9a0bf295415642fae8e8cdad846a diff --git a/rt/t/customfields/api.t b/rt/t/customfields/api.t index a50ca770c..f4551b363 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;