summaryrefslogtreecommitdiff
path: root/rt/t/ticket/search_by_txn.t
blob: 0e5f76dcd609f48e651ac77d5524b217757dd192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl

use warnings;
use strict;


BEGIN{ $ENV{'TZ'} = 'GMT'};

use RT::Test tests => 10;

my $SUBJECT = "Search test - ".$$;

use_ok('RT::Tickets');
my $tix = RT::Tickets->new(RT->SystemUser);
can_ok($tix, 'FromSQL');
$tix->FromSQL('Updated = "2005-08-05" AND Subject = "$SUBJECT"');

ok(! $tix->Count, "Searching for tickets updated on a random date finds nothing" . $tix->Count);

my $ticket = RT::Ticket->new(RT->SystemUser);
$ticket->Create(Queue => 'General', Subject => $SUBJECT);
ok ($ticket->id, "We created a ticket");
my ($id, $txnid, $txnobj) =  $ticket->Comment( Content => 'A comment that happend on 2004-01-01');

isa_ok($txnobj, 'RT::Transaction');

ok($txnobj->CreatedObj->ISO);
my ( $sid,$smsg) = $txnobj->__Set(Field => 'Created', Value => '2005-08-05 20:00:56');
ok($sid,$smsg);
is($txnobj->Created,'2005-08-05 20:00:56');
is($txnobj->CreatedObj->ISO,'2005-08-05 20:00:56');

$tix->FromSQL(qq{Updated = "2005-08-05" AND Subject = "$SUBJECT"});
is( $tix->Count, 1);