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