[Rt-commit] rt branch, 4.2/cf-is-null-warnings, updated. rt-4.2.4-98-gf9a0394
Alex Vandiver
alexmv at bestpractical.com
Fri Jun 13 14:43:58 EDT 2014
The branch, 4.2/cf-is-null-warnings has been updated
via f9a0394f8a1ec75afb883fe046159c6ffb64c187 (commit)
from 9e7f38419482cf1676816696b2d2ebc70e1a6635 (commit)
Summary of changes:
t/customfields/date_search.t | 25 ++++++++++++++++++++++++-
t/customfields/datetime_search.t | 26 +++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit f9a0394f8a1ec75afb883fe046159c6ffb64c187
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jun 13 14:43:52 2014 -0400
Add tests for date and datetime IS NULL/IS NOT NULL
diff --git a/t/customfields/date_search.t b/t/customfields/date_search.t
index 724c1c1..e9a5a5e 100644
--- a/t/customfields/date_search.t
+++ b/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(
@@ -134,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);
@@ -164,3 +186,4 @@ is( $ticket->CustomFieldValues->First->Content, '2010-05-04', 'date in db is' );
is( $tickets->Count, 1, 'found the tickets' );
}
+done_testing;
diff --git a/t/customfields/datetime_search.t b/t/customfields/datetime_search.t
index ff3028f..2eaa0e6 100644
--- a/t/customfields/datetime_search.t
+++ b/t/customfields/datetime_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 => 30;
+use RT::Test nodata => 1, tests => undef;
RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
RT::Test->set_rights(
@@ -206,6 +206,29 @@ while( my $ticket = $tickets->Next ) {
is( $tickets->Count, 0);
}
+{
+ 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, 2, 'did find the ticket with date IS NOT NULL' );
+}
+
+
# search by relative date with '=', but date only
{
my $ticket = RT::Ticket->new(RT->SystemUser);
@@ -237,3 +260,4 @@ while( my $ticket = $tickets->Next ) {
is( $tickets->Count, 0);
}
+done_testing;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list