import rt 3.8.7
[freeside.git] / rt / t / ticket / search_by_txn.t
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6
7 BEGIN{ $ENV{'TZ'} = 'GMT'};
8
9 use RT::Test tests => 10;
10
11 my $SUBJECT = "Search test - ".$$;
12
13 use_ok('RT::Tickets');
14 my $tix = RT::Tickets->new($RT::SystemUser);
15 can_ok($tix, 'FromSQL');
16 $tix->FromSQL('Updated = "2005-08-05" AND Subject = "$SUBJECT"');
17
18 ok(! $tix->Count, "Searching for tickets updated on a random date finds nothing" . $tix->Count);
19
20 my $ticket = RT::Ticket->new($RT::SystemUser);
21 $ticket->Create(Queue => 'General', Subject => $SUBJECT);
22 ok ($ticket->id, "We created a ticket");
23 my ($id, $txnid, $txnobj) =  $ticket->Comment( Content => 'A comment that happend on 2004-01-01');
24
25 isa_ok($txnobj, 'RT::Transaction');
26
27 ok($txnobj->CreatedObj->ISO);
28 my ( $sid,$smsg) = $txnobj->__Set(Field => 'Created', Value => '2005-08-05 20:00:56');
29 ok($sid,$smsg);
30 is($txnobj->Created,'2005-08-05 20:00:56');
31 is($txnobj->CreatedObj->ISO,'2005-08-05 20:00:56');
32
33 $tix->FromSQL(qq{Updated = "2005-08-05" AND Subject = "$SUBJECT"});
34 is( $tix->Count, 1);
35