4 use RT::Test tests => 46;
5 my ( $url, $m ) = RT::Test->started_ok;
6 ok( $m->login, 'logged in' );
8 my $rtname = RT->Config->Get('rtname');
13 my ( @link_tickets, @search_tickets );
15 my $link_ticket = RT::Ticket->new(RT->SystemUser);
16 my ( $ret, $msg ) = $link_ticket->Create(
17 Subject => "link ticket $_",
20 Requestor => 'root@localhost',
22 ok( $ret, "link ticket created: $msg" );
23 push @link_tickets, $ret;
27 my $ticket = RT::Ticket->new(RT->SystemUser);
28 my ( $ret, $msg ) = $ticket->Create(
29 Subject => "search ticket $_",
32 Requestor => 'root@localhost',
34 ok( $ret, "search ticket created: $msg" );
35 push @search_tickets, $ret;
38 # let's add link to 1 search ticket first
39 $m->get_ok( $url . "/Search/Bulk.html?Query=id=$search_tickets[0]&Rows=10" );
40 $m->content_contains( 'Current Links', 'has current links part' );
41 $m->content_lacks( 'DeleteLink--', 'no delete link stuff' );
43 form_name => 'BulkUpdate',
45 'Ticket-DependsOn' => $link_tickets[0],
46 'Ticket-MemberOf' => $link_tickets[1],
47 'Ticket-RefersTo' => $link_tickets[2],
51 "Ticket $search_tickets[0] depends on Ticket $link_tickets[0]",
55 "Ticket $search_tickets[0] member of Ticket $link_tickets[1]",
59 "Ticket $search_tickets[0] refers to Ticket $link_tickets[2]",
64 "DeleteLink--DependsOn-fsck.com-rt://$rtname/ticket/$link_tickets[0]",
65 'found depends on link' );
67 "DeleteLink--MemberOf-fsck.com-rt://$rtname/ticket/$link_tickets[1]",
68 'found member of link' );
70 "DeleteLink--RefersTo-fsck.com-rt://$rtname/ticket/$link_tickets[2]",
71 'found refers to link' );
73 # here we check the *real* bulk update
74 my $query = join ' OR ', map { "id=$_" } @search_tickets;
75 $m->get_ok( $url . "/Search/Bulk.html?Query=$query&Rows=10" );
76 $m->content_contains( 'Current Links', 'has current links part' );
77 $m->content_lacks( 'DeleteLink--', 'no delete link stuff' );
79 $m->form_name('BulkUpdate');
80 my @fields = qw/Owner AddRequestor DeleteRequestor AddCc DeleteCc AddAdminCc
81 DeleteAdminCc Subject Priority Queue Status Starts_Date Told_Date Due_Date
82 UpdateSubject UpdateContent/;
83 for my $field ( @fields ) {
84 is( $m->value($field), '', "default $field is empty" );
87 # test DependsOn, MemberOf and RefersTo
89 form_name => 'BulkUpdate',
91 'Ticket-DependsOn' => $link_tickets[0],
92 'Ticket-MemberOf' => $link_tickets[1],
93 'Ticket-RefersTo' => $link_tickets[2],
98 "DeleteLink--DependsOn-fsck.com-rt://$rtname/ticket/$link_tickets[0]",
99 'found depends on link' );
100 $m->content_contains(
101 "DeleteLink--MemberOf-fsck.com-rt://$rtname/ticket/$link_tickets[1]",
102 'found member of link' );
103 $m->content_contains(
104 "DeleteLink--RefersTo-fsck.com-rt://$rtname/ticket/$link_tickets[2]",
105 'found refers to link' );
108 form_name => 'BulkUpdate',
110 "DeleteLink--DependsOn-fsck.com-rt://$rtname/ticket/$link_tickets[0]" =>
112 "DeleteLink--MemberOf-fsck.com-rt://$rtname/ticket/$link_tickets[1]" =>
114 "DeleteLink--RefersTo-fsck.com-rt://$rtname/ticket/$link_tickets[2]" =>
119 $m->content_lacks( 'DeleteLink--', 'links are all deleted' );
121 # test DependedOnBy, Members and ReferredToBy
124 form_name => 'BulkUpdate',
126 'DependsOn-Ticket' => $link_tickets[0],
127 'MemberOf-Ticket' => $link_tickets[1],
128 'RefersTo-Ticket' => $link_tickets[2],
132 $m->content_contains(
133 "DeleteLink-fsck.com-rt://$rtname/ticket/$link_tickets[0]-DependsOn-",
134 'found depended on link' );
135 $m->content_contains(
136 "DeleteLink-fsck.com-rt://$rtname/ticket/$link_tickets[1]-MemberOf-",
137 'found members link' );
138 $m->content_contains(
139 "DeleteLink-fsck.com-rt://$rtname/ticket/$link_tickets[2]-RefersTo-",
140 'found referrd to link' );
143 form_name => 'BulkUpdate',
145 "DeleteLink-fsck.com-rt://$rtname/ticket/$link_tickets[0]-DependsOn-" =>
147 "DeleteLink-fsck.com-rt://$rtname/ticket/$link_tickets[1]-MemberOf-" =>
149 "DeleteLink-fsck.com-rt://$rtname/ticket/$link_tickets[2]-RefersTo-" =>
153 $m->content_lacks( 'DeleteLink--', 'links are all deleted' );