diff options
Diffstat (limited to 'rt/t/ticket/search_by_txn.t')
-rw-r--r-- | rt/t/ticket/search_by_txn.t | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/rt/t/ticket/search_by_txn.t b/rt/t/ticket/search_by_txn.t new file mode 100644 index 0000000..1be6916 --- /dev/null +++ b/rt/t/ticket/search_by_txn.t @@ -0,0 +1,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); + |