Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
best-practical
rt
Commits
f9a0394f
Commit
f9a0394f
authored
Jun 13, 2014
by
Alex Vandiver
Browse files
Add tests for date and datetime IS NULL/IS NOT NULL
parent
9e7f3841
Changes
2
Hide whitespace changes
Inline
Side-by-side
t/customfields/date_search.t
View file @
f9a0394f
...
...
@@ -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
;
t/customfields/datetime_search.t
View file @
f9a0394f
...
...
@@ -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
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment