6 use RT::Test nodata => 1, tests => 13;
8 my $q = RT::Queue->new(RT->SystemUser);
9 ok( $q->Create( Name => 'DateCFTest' . $$ ), 'create queue' );
11 my $cf = RT::CustomField->new(RT->SystemUser);
17 LookupType => RT::Ticket->CustomFieldLookupType,
21 ok( $cf->AddToObject($q), 'date cf apply to queue' );
23 my $ticket = RT::Ticket->new(RT->SystemUser);
29 'CustomField-' . $cf->id => '2010-05-04',
31 'create ticket with cf set to 2010-05-04'
34 is( $ticket->CustomFieldValues->First->Content, '2010-05-04', 'date in db is' );
38 my $tickets = RT::Tickets->new(RT->SystemUser);
39 $tickets->LimitCustomField(
40 CUSTOMFIELD => $cf->id,
42 VALUE => '2010-05-04',
44 is( $tickets->Count, 1, 'found the ticket with exact date: 2010-05-04' );
49 my $tickets = RT::Tickets->new(RT->SystemUser);
50 $tickets->LimitCustomField(
51 CUSTOMFIELD => $cf->id,
53 VALUE => '2010-05-03',
56 is( $tickets->Count, 1, 'found ticket with > 2010-05-03' );
60 my $tickets = RT::Tickets->new(RT->SystemUser);
61 $tickets->LimitCustomField(
62 CUSTOMFIELD => $cf->id,
64 VALUE => '2010-05-05',
67 is( $tickets->Count, 1, 'found ticket with < 2010-05-05' );
72 my $tickets = RT::Tickets->new(RT->SystemUser);
73 $tickets->LimitCustomField(
74 CUSTOMFIELD => $cf->id,
76 VALUE => '2010-05-05',
79 is( $tickets->Count, 0, 'did not find the ticket with = 2010-05-05' );
84 my $tickets = RT::Tickets->new(RT->SystemUser);
85 $tickets->LimitCustomField(
86 CUSTOMFIELD => $cf->id,
88 VALUE => '2010-05-03',
91 is( $tickets->Count, 0, 'did not find the ticket with < 2010-05-03' );
96 my $tickets = RT::Tickets->new(RT->SystemUser);
97 $tickets->LimitCustomField(
98 CUSTOMFIELD => $cf->id,
100 VALUE => '2010-05-05',
103 is( $tickets->Count, 0, 'did not find the ticket with > 2010-05-05' );
106 $ticket = RT::Ticket->new(RT->SystemUser);
112 'CustomField-' . $cf->id => '2010-05-04 11:34:56',
114 'create ticket with cf set to 2010-05-04 11:34:56'
117 is( $ticket->CustomFieldValues->First->Content,
118 '2010-05-04', 'date in db only has date' );