diff options
author | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:08 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:08 -0700 |
commit | 88bf5db0cca989c51237c661a13078eef08b3674 (patch) | |
tree | 0a84e1b5e7fd239f57fab678bf40c5311b0064a0 /rt/t/customfields/date_search.t | |
parent | 9c15ffe3a5ee987e30e10c6a0ad1b5bf0b2a12e3 (diff) | |
parent | e7eb845db1afab1cbdbc34ff9c387c5ac554659e (diff) |
Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into 4.x
Diffstat (limited to 'rt/t/customfields/date_search.t')
-rw-r--r-- | rt/t/customfields/date_search.t | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/rt/t/customfields/date_search.t b/rt/t/customfields/date_search.t index 2a8e6ce7a..e9a5a5e76 100644 --- a/rt/t/customfields/date_search.t +++ b/rt/t/customfields/date_search.t @@ -3,7 +3,7 @@ use Test::MockTime qw(set_fixed_time restore_time); use warnings; use strict; -use RT::Test nodata => 1, tests => 21; +use RT::Test nodata => 1, tests => undef; RT::Test->set_rights( { Principal => 'Everyone', Right => [qw( @@ -16,9 +16,11 @@ ok $q && $q->id, 'loaded or created a queue'; my $user_m = RT::Test->load_or_create_user( Name => 'moscow', Timezone => 'Europe/Moscow' ); ok $user_m && $user_m->id; +$user_m = RT::CurrentUser->new( $user_m ); my $user_b = RT::Test->load_or_create_user( Name => 'boston', Timezone => 'America/New_York' ); ok $user_b && $user_b->id; +$user_b = RT::CurrentUser->new( $user_b ); my $cf = RT::CustomField->new(RT->SystemUser); ok( @@ -132,6 +134,28 @@ is( $ticket->CustomFieldValues->First->Content, '2010-05-04', 'date in db is' ); is( $tickets->Count, 0, 'did not find the ticket with > 2010-05-05' ); } +{ + my $tickets = RT::Tickets->new(RT->SystemUser); + $tickets->LimitCustomField( + CUSTOMFIELD => $cf->id, + OPERATOR => 'IS', + VALUE => 'NULL', + ); + + is( $tickets->Count, 0, 'did not find the ticket with date IS NULL' ); +} + +{ + my $tickets = RT::Tickets->new(RT->SystemUser); + $tickets->LimitCustomField( + CUSTOMFIELD => $cf->id, + OPERATOR => 'IS NOT', + VALUE => 'NULL', + ); + + is( $tickets->Count, 1, 'did find the ticket with date IS NOT NULL' ); +} + # relative search by users in different TZs { my $ticket = RT::Ticket->new(RT->SystemUser); @@ -162,3 +186,4 @@ is( $ticket->CustomFieldValues->First->Content, '2010-05-04', 'date in db is' ); is( $tickets->Count, 1, 'found the tickets' ); } +done_testing; |