1use strict; 2use warnings; 3use Test::Expect; 4use RT::Test tests => 12, actual_server => 1; 5 6my $class = RT::Class->new( RT->SystemUser ); 7my ( $class_id, $msg ) = $class->Create( Name => 'foo' ); 8ok( $class_id, $msg ); 9 10my $article = RT::Article->new( RT->SystemUser ); 11( my $article_id, $msg ) = 12 $article->Create( Class => 'foo', Summary => 'article summary' ); 13ok( $article_id, $msg ); 14 15my ( $baseurl, $m ) = RT::Test->started_ok; 16my $rt_tool_path = "$RT::BinPath/rt"; 17 18$ENV{'RTUSER'} = 'root'; 19$ENV{'RTPASSWD'} = 'password'; 20$RT::Logger->debug( 21 "Connecting to server at " . RT->Config->Get('WebBaseURL') ); 22$ENV{'RTSERVER'} = RT->Config->Get('WebBaseURL'); 23$ENV{'RTDEBUG'} = '1'; 24$ENV{'RTCONFIG'} = '/dev/null'; 25 26expect_run( 27 command => "$rt_tool_path shell", 28 prompt => 'rt> ', 29 quit => 'quit', 30); 31expect_send( q{create -t ticket set subject='new ticket'}, 32 "creating a ticket..." ); 33 34expect_like( qr/Ticket \d+ created/, "created the ticket" ); 35expect_handle->before() =~ /Ticket (\d+) created/; 36my $ticket_id = $1; 37expect_send( 38 "link $ticket_id RefersTo a:$article_id", 39 "link $ticket_id RefersTo a:$article_id" 40); 41expect_like( qr/Created link $ticket_id RefersTo a:$article_id/, 42 'created link' ); 43expect_send( "show -s ticket/$ticket_id/links", "show ticket links" ); 44expect_like( qr|RefersTo: fsck\.com-article://example\.com/article/$article_id|, 45 "found new created link" ); 46 47expect_quit(); 48 49