Commit f9a0394f authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Add tests for date and datetime IS NULL/IS NOT NULL

parent 9e7f3841
......@@ -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;
......@@ -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;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment