[Rt-commit] rt branch, 4.2/lower-level-ocfv-cache-update-code, updated. rt-4.2.14-35-g33007053a
? sunnavy
sunnavy at bestpractical.com
Tue Mar 20 08:36:12 EDT 2018
The branch, 4.2/lower-level-ocfv-cache-update-code has been updated
via 33007053adece19009254b11e3ba1153514e76e5 (commit)
from b7453fc6b8e8b305771b47af91019dbbe79bf841 (commit)
Summary of changes:
t/customfields/cached_values.t | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 t/customfields/cached_values.t
- Log -----------------------------------------------------------------
commit 33007053adece19009254b11e3ba1153514e76e5
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Mar 20 20:32:40 2018 +0800
More ocfv cache tests
diff --git a/t/customfields/cached_values.t b/t/customfields/cached_values.t
new file mode 100644
index 000000000..bc10996ab
--- /dev/null
+++ b/t/customfields/cached_values.t
@@ -0,0 +1,32 @@
+use warnings;
+use strict;
+
+use RT::Test tests => undef;
+
+my $ticket = RT::Test->create_ticket( Subject => 'test ocfv cache', Queue => 'General' );
+
+my $cf = RT::Test->load_or_create_custom_field(
+ Name => 'freeform single',
+ 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' );
+
+done_testing;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list