[Rt-commit] r9055 - rt/branches/3.7-EXPERIMENTAL/t/web

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Sep 14 14:21:55 EDT 2007


Author: sunnavy
Date: Fri Sep 14 14:21:54 2007
New Revision: 9055

Modified:
   rt/branches/3.7-EXPERIMENTAL/t/web/cf_access.t

Log:
$1 can't be seen out of the block around it.
better variable names, too

Modified: rt/branches/3.7-EXPERIMENTAL/t/web/cf_access.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/cf_access.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/cf_access.t	Fri Sep 14 14:21:54 2007
@@ -29,7 +29,7 @@
 }
 
 diag "apply the CF to General queue" if $ENV{'TEST_VERBOSE'};
-my $cfid;
+my ( $cf, $cfid, $tid );
 {
     $m->title_is(q/Created CustomField img/, 'admin-cf created');
     $m->follow_link( text => 'Queues' );
@@ -46,9 +46,10 @@
                 sort { $a->[0] <=> $b->[0] }
                 map  { /Object-1-CF-(\d+)/ ? [ $1 => $_ ] : () }
                 grep defined, map $_->name, $m->current_form->inputs;
-    $cfid = pop(@names);
-    $cfid =~ /(\d+)$/ or die "Hey this is impossible dude";
-    $m->field( $cfid => 1 );         # Associate the new CF with this queue
+    $cf = pop(@names);
+    $cf =~ /(\d+)$/ or die "Hey this is impossible dude";
+    $cfid = $1;
+    $m->field( $cf => 1 );         # Associate the new CF with this queue
     $m->field( $_ => undef ) for @names;    # ...and not any other. ;-)
     $m->submit;
 
@@ -74,7 +75,7 @@
     $m->content_unlike(qr/Upload multiple images/, 'has no upload image field');
 
     my $form = $m->form_name("TicketCreate");
-    my $upload_field = "Object-RT::Ticket--CustomField-$1-Upload";
+    my $upload_field = "Object-RT::Ticket--CustomField-$cfid-Upload"; 
     ok !$form->find_input( $upload_field ), 'no form field on the page';
 
     $m->submit_form(
@@ -105,14 +106,14 @@
     $m->content_unlike(qr/Upload multiple images/, 'has no upload image field');
 
     my $form = $m->form_name("TicketCreate");
-    my $upload_field = "Object-RT::Ticket--CustomField-$1-Upload";
+    my $upload_field = "Object-RT::Ticket--CustomField-$cfid-Upload";
     ok !$form->find_input( $upload_field ), 'no form field on the page';
 
     $m->submit_form(
         form_name => "TicketCreate",
         fields => { Subject => 'test' },
     );
-    my $tid = $1 if $m->content =~ /Ticket (\d+) created/i;
+    $tid = $1 if $m->content =~ /Ticket (\d+) created/i;
     ok $tid, "a ticket is created succesfully";
 
     $m->follow_link( text => 'Custom Fields' );
@@ -129,7 +130,6 @@
 );
 
 diag "create a ticket with an image" if $ENV{'TEST_VERBOSE'};
-my $tid;
 {
     $m->submit_form(
         form_name => "CreateTicketInQueue",
@@ -137,7 +137,7 @@
     );
     $m->content_like(qr/Upload multiple images/, 'has a upload image field');
 
-    $cfid =~ /(\d+)$/ or die "Hey this is impossible dude";
+    $cf =~ /(\d+)$/ or die "Hey this is impossible dude";
     my $upload_field = "Object-RT::Ticket--CustomField-$1-Upload";
 
     $m->submit_form(


More information about the Rt-commit mailing list