fix ticketing system error on bootstrap of new install
[freeside.git] / rt / t / ticket / badlinks.t
1 use strict;
2 use warnings;
3 use RT::Test tests => 14;
4
5 my ($baseurl, $m) = RT::Test->started_ok;
6 ok($m->login, "Logged in");
7
8 my $queue = RT::Test->load_or_create_queue(Name => 'General');
9 ok($queue->Id, "loaded the General queue");
10
11 my $ticket = RT::Ticket->new(RT->SystemUser);
12 my ($tid, $txn, $msg) = $ticket->Create(
13         Queue => $queue->id,
14         Subject => 'test links',
15         );
16 ok $tid, 'created a ticket #'. $tid or diag "error: $msg";
17
18 $m->goto_ticket($tid);
19
20 $m->follow_link_ok( { text => 'Links' }, "Followed link to Links" );
21
22 ok $m->form_with_fields("$tid-DependsOn"), "found the form";
23 my $not_a_ticket_url = "http://example.com/path/to/nowhere";
24 $m->field("$tid-DependsOn", $not_a_ticket_url);
25 $m->field("DependsOn-$tid", $not_a_ticket_url);
26 $m->field("$tid-MemberOf", $not_a_ticket_url);
27 $m->field("MemberOf-$tid", $not_a_ticket_url);
28 $m->field("$tid-RefersTo", $not_a_ticket_url);
29 $m->field("RefersTo-$tid", $not_a_ticket_url);
30 $m->submit;
31
32 foreach my $type ("depends on", "member of", "refers to") {
33     $m->content_like(qr/$type.+$not_a_ticket_url/,"base for $type");
34     $m->content_like(qr/$not_a_ticket_url.+$type/,"target for $type");
35 }
36
37 $m->goto_ticket($tid);