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