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