[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.6-331-g3c31dd4

? sunnavy sunnavy at bestpractical.com
Thu Dec 2 08:18:01 EST 2010


The branch, 3.9-trunk has been updated
       via  3c31dd43f9d5175d2a629afe88b423e0729dfece (commit)
       via  a41400702e47a3ede03dbab473ad4447b0146af3 (commit)
       via  029b3dfd0554ae221709250df31ac058b46380f5 (commit)
       via  4d09a17dbe5532ecae154c3390fe3ca44273752a (commit)
       via  06fc323cc9d3b1afe4cc8f8a557c94678eb62d51 (commit)
       via  c988ff4939d014bf06e70ef8001560b01b911f64 (commit)
      from  57738b819c82ecc95e449f6c080b3be5e01ea52d (commit)

Summary of changes:
 lib/RT/Lifecycle.pm                     |   16 +++++-----
 lib/RT/Test.pm                          |    8 +++++
 lib/RT/Test/Web.pm                      |    2 +-
 t/mail/dashboards.t                     |    6 +---
 t/web/command_line.t                    |    8 ++++-
 t/web/command_line_with_unknown_field.t |    8 +++++-
 t/web/compilation_errors.t              |    5 ++-
 t/web/query_builder.t                   |   44 ++++++++++++++++--------------
 8 files changed, 57 insertions(+), 40 deletions(-)

- Log -----------------------------------------------------------------
commit c988ff4939d014bf06e70ef8001560b01b911f64
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 2 20:21:13 2010 +0800

    warning fix

diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index f6be775..f1ecad0 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -225,8 +225,8 @@ See also </valid>.
 
 sub IsValid {
     my $self  = shift;
-    my $value = lc shift;
-    return 1 if grep lc($_) eq $value, $self->Valid( @_ );
+    my $value = shift or return 0;
+    return 1 if grep lc($_) eq lc($value), $self->Valid( @_ );
     return 0;
 }
 
@@ -266,8 +266,8 @@ Otherwise, returns false.
 
 sub IsInitial {
     my $self  = shift;
-    my $value = lc shift;
-    return 1 if grep lc($_) eq $value, $self->Valid('initial');
+    my $value = shift or return 0;
+    return 1 if grep lc($_) eq lc($value), $self->Valid('initial');
     return 0;
 }
 
@@ -292,8 +292,8 @@ Otherwise, returns false.
 
 sub IsActive {
     my $self  = shift;
-    my $value = lc shift;
-    return 1 if grep lc($_) eq $value, $self->Valid('active');
+    my $value = shift or return 0;
+    return 1 if grep lc($_) eq lc($value), $self->Valid('active');
     return 0;
 }
 
@@ -317,8 +317,8 @@ Otherwise, returns false.
 
 sub IsInactive {
     my $self  = shift;
-    my $value = lc shift;
-    return 1 if grep lc($_) eq $value, $self->Valid('inactive');
+    my $value = shift or return 0;
+    return 1 if grep lc($_) eq lc($value), $self->Valid('inactive');
     return 0;
 }
 

commit 06fc323cc9d3b1afe4cc8f8a557c94678eb62d51
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 2 20:21:48 2010 +0800

    ease the ::Lexicon used only once warning

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index f24db43..9832392 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1544,4 +1544,12 @@ END {
     }
 }
 
+{ 
+    # ease the used only once warning
+    no warnings;
+    no strict 'refs';
+    %{'RT::I18N::en_us::Lexicon'};
+    %{'Win32::Locale::Lexicon'};
+}
+
 1;

commit 4d09a17dbe5532ecae154c3390fe3ca44273752a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 2 20:48:04 2010 +0800

    catch the Time::ParseDate warning

diff --git a/t/web/command_line.t b/t/web/command_line.t
index 22edc86..805cf41 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -51,6 +51,7 @@ expect_run(
     quit => 'quit',
 );
 expect_send(q{create -t ticket set subject='new ticket' add cc=foo at example.com}, "Creating a ticket...");
+
 expect_like(qr/Ticket \d+ created/, "Created the ticket");
 expect_handle->before() =~ /Ticket (\d+) created/;
 my $ticket_id = $1;
@@ -380,8 +381,6 @@ ok($merge_ticket_B, "Got second ticket to merge id=$merge_ticket_B");
 expect_send("merge $merge_ticket_B $merge_ticket_A", 'Merging the tickets...');
 expect_like(qr/Merge completed/, 'Merged the tickets');
 
-$m->no_warnings_ok;
-
 expect_send("show ticket/$merge_ticket_A/history", 'Checking merge on first ticket');
 expect_like(qr/Merged into ticket #$merge_ticket_A by root/, 'Merge recorded in first ticket');
 expect_send("show ticket/$merge_ticket_B/history", 'Checking merge on second ticket');
@@ -520,4 +519,9 @@ sub check_attachment {
     }
 }
 
+# you may encounter warning like Use of uninitialized value $ampm
+# ... in Time::ParseDate
+my @warnings = grep { $_ !~ /\$ampm/ } $m->get_warnings;
+is( scalar @warnings, 0, 'no extra warnings' );
+
 1; # needed to avoid a weird exit value from expect_quit
diff --git a/t/web/command_line_with_unknown_field.t b/t/web/command_line_with_unknown_field.t
index 5557e10..426d90b 100644
--- a/t/web/command_line_with_unknown_field.t
+++ b/t/web/command_line_with_unknown_field.t
@@ -3,7 +3,7 @@
 use strict;
 use File::Spec ();
 use Test::Expect;
-use RT::Test tests => 12, actual_server => 1;
+use RT::Test tests => 14, actual_server => 1;
 my ($baseurl, $m) = RT::Test->started_ok;
 my $rt_tool_path = "$RT::BinPath/rt";
 
@@ -19,6 +19,7 @@ expect_run(
     quit => 'quit',
 );
 expect_send(q{create -t ticket set subject='new ticket' add cc=foo at example.com}, "Creating a ticket...");
+
 expect_like(qr/Ticket \d+ created/, "Created the ticket");
 expect_handle->before() =~ /Ticket (\d+) created/;
 my $ticket_id = $1;
@@ -33,4 +34,9 @@ expect_like(qr/homer: simpson/, 'the value we set for homer is shown too');
 
 expect_quit();
 
+# you may encounter warning like Use of uninitialized value $ampm
+# ... in Time::ParseDate
+my @warnings = grep { $_ !~ /\$ampm/ } $m->get_warnings;
+is( scalar @warnings, 0, 'no extra warnings' );
+
 1; # needed to avoid a weird exit value from expect_quit

commit 029b3dfd0554ae221709250df31ac058b46380f5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 2 20:48:30 2010 +0800

    don't call $agent directly in subs, trans it to @_ first.
    
        we need to use $agent->DESTROY to add extra warnings clean tests, calling
    $agent in sub directly may cause ->DESTROY called too late

diff --git a/t/web/compilation_errors.t b/t/web/compilation_errors.t
index cbe7415..81be7e7 100644
--- a/t/web/compilation_errors.t
+++ b/t/web/compilation_errors.t
@@ -7,7 +7,7 @@ BEGIN {
     sub wanted {
         -f && /\.html$/ && $_ !~ /Logout.html$/;
     }
-    my $tests = 6;
+    my $tests = 8;
     find( sub { wanted() and $tests += 4 }, 'share/html/' );
     plan tests => $tests;
 }
@@ -38,7 +38,7 @@ is($agent->status, 200, "Fetched the page ok");
 $agent->content_contains('Logout', "Found a logout link");
 
 
-find ( sub { wanted() and test_get($File::Find::name) } , 'share/html/');
+find ( sub { wanted() and test_get($agent, $File::Find::name) } , 'share/html/');
 
 TODO: {
     local $TODO = "we spew *lots* of undef warnings";
@@ -46,6 +46,7 @@ TODO: {
 };
 
 sub test_get {
+    my $agent = shift;
         my $file = shift;
 
         $file =~ s#^share/html/##;
diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index 2467ece..38ea19d 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -5,7 +5,7 @@ use HTTP::Request::Common;
 use HTTP::Cookies;
 use LWP;
 use Encode;
-use RT::Test tests => 44;
+use RT::Test tests => 46;
 
 my $cookie_jar = HTTP::Cookies->new;
 my ($baseurl, $agent) = RT::Test->started_ok;
@@ -27,6 +27,7 @@ my $response = $agent->get($url."Search/Build.html");
 ok $response->is_success, "Fetched ". $url ."Search/Build.html";
 
 sub getQueryFromForm {
+    my $agent = shift;
     $agent->form_name('BuildQuery');
     # This pulls out the "hidden input" query from the page
     my $q = $agent->current_form->find_input("Query")->value;
@@ -37,6 +38,7 @@ sub getQueryFromForm {
 }
 
 sub selectedClauses {
+    my $agent = shift;
     my @clauses = grep { defined } map { $_->value } $agent->current_form->find_input("clauses");
     return [ @clauses ];
 }
@@ -49,7 +51,7 @@ diag "add the first condition";
     $agent->field("ActorOp", "=");
     $agent->field("ValueOfActor", "Nobody");
     $agent->submit;
-    is getQueryFromForm, "Owner = 'Nobody'", 'correct query';
+    is getQueryFromForm($agent), "Owner = 'Nobody'", 'correct query';
 }
 
 diag "set the next condition";
@@ -58,7 +60,7 @@ diag "set the next condition";
     $agent->field("QueueOp", "!=");
     $agent->field("ValueOfQueue", "Regression");
     $agent->submit;
-    is getQueryFromForm, "Owner = 'Nobody' AND Queue != 'Regression'",
+    is getQueryFromForm($agent), "Owner = 'Nobody' AND Queue != 'Regression'",
         'correct query';
 }
 
@@ -67,7 +69,7 @@ diag "We're going to delete the owner";
     $agent->select("clauses", ["0"] );
     $agent->click("DeleteClause");
     ok $agent->form_name('BuildQuery'), "found the form";
-    is getQueryFromForm, "Queue != 'Regression'", 'correct query';
+    is getQueryFromForm($agent), "Queue != 'Regression'", 'correct query';
 }
 
 diag "add a cond with OR and se number by the way";
@@ -77,9 +79,9 @@ diag "add a cond with OR and se number by the way";
     $agent->field("ValueOfid" => "1234");
     $agent->click("AddClause");
     ok $agent->form_name('BuildQuery'), "found the form again";
-    is getQueryFromForm, "Queue != 'Regression' OR id > 1234",
+    is getQueryFromForm($agent), "Queue != 'Regression' OR id > 1234",
         "added something as OR, and number not quoted";
-    is_deeply selectedClauses, ["1"], 'the id that we just entered is still selected';
+    is_deeply selectedClauses($agent), ["1"], 'the id that we just entered is still selected';
 
 }
 
@@ -87,17 +89,17 @@ diag "Move the second one up a level";
 {
     $agent->click("Up");
     ok $agent->form_name('BuildQuery'), "found the form again";
-    is getQueryFromForm, "id > 1234 OR Queue != 'Regression'", "moved up one";
-    is_deeply selectedClauses, ["0"], 'the one we moved up is selected';
+    is getQueryFromForm($agent), "id > 1234 OR Queue != 'Regression'", "moved up one";
+    is_deeply selectedClauses($agent), ["0"], 'the one we moved up is selected';
 }
 
 diag "Move the second one right";
 {
     $agent->click("Right");
     ok $agent->form_name('BuildQuery'), "found the form again";
-    is getQueryFromForm, "Queue != 'Regression' OR ( id > 1234 )",
+    is getQueryFromForm($agent), "Queue != 'Regression' OR ( id > 1234 )",
         "moved over to the right (and down)";
-    is_deeply selectedClauses, ["2"], 'the one we moved right is selected';
+    is_deeply selectedClauses($agent), ["2"], 'the one we moved right is selected';
 }
 
 diag "Move the block up";
@@ -105,8 +107,8 @@ diag "Move the block up";
     $agent->select("clauses", ["1"]);
     $agent->click("Up");
     ok $agent->form_name('BuildQuery'), "found the form again";
-    is getQueryFromForm, "( id > 1234 ) OR Queue != 'Regression'", "moved up";
-    is_deeply selectedClauses, ["0"], 'the one we moved up is selected';
+    is getQueryFromForm($agent), "( id > 1234 ) OR Queue != 'Regression'", "moved up";
+    is_deeply selectedClauses($agent), ["0"], 'the one we moved up is selected';
 }
 
 
@@ -116,7 +118,7 @@ diag "Can not move up the top most clause";
     $agent->click("Up");
     ok $agent->form_name('BuildQuery'), "found the form again";
     $agent->content_contains("error: can&#39;t move up", "i shouldn't have been able to hit up");
-    is_deeply selectedClauses, ["0"], 'the one we tried to move is selected';
+    is_deeply selectedClauses($agent), ["0"], 'the one we tried to move is selected';
 }
 
 diag "Can not move left the left most clause";
@@ -124,7 +126,7 @@ diag "Can not move left the left most clause";
     $agent->click("Left");
     ok($agent->form_name('BuildQuery'), "found the form again");
     $agent->content_contains("error: can&#39;t move left", "i shouldn't have been able to hit left");
-    is_deeply selectedClauses, ["0"], 'the one we tried to move is selected';
+    is_deeply selectedClauses($agent), ["0"], 'the one we tried to move is selected';
 }
 
 diag "Add a condition into a nested block";
@@ -133,8 +135,8 @@ diag "Add a condition into a nested block";
     $agent->select("ValueOfStatus" => "stalled");
     $agent->submit;
     ok $agent->form_name('BuildQuery'), "found the form again";
-    is_deeply selectedClauses, ["2"], 'the one we added is only selected';
-    is getQueryFromForm,
+    is_deeply selectedClauses($agent), ["2"], 'the one we added is only selected';
+    is getQueryFromForm($agent),
         "( id > 1234 AND Status = 'stalled' ) OR Queue != 'Regression'",
         "added new one";
 }
@@ -146,7 +148,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
     ok($agent->form_name('BuildQueryAdvanced'), "found the form");
     $agent->field("Query", "Status = 'new' OR ( Status = 'open' AND Subject LIKE 'office' )");
     $agent->submit;
-    is( getQueryFromForm,
+    is( getQueryFromForm($agent),
         "Status = 'new' OR ( Status = 'open' AND Subject LIKE 'office' )",
         "no aggregators change"
     );
@@ -214,7 +216,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
     ok($agent->form_name('BuildQuery'), "found the form once");
     $agent->field("ValueOf'CF.{\x{442}}'", "\x{441}");
     $agent->submit();
-    is( getQueryFromForm,
+    is( getQueryFromForm($agent),
         "'CF.{\x{442}}' LIKE '\x{441}'",
         "no changes, no duplicate condition with badly encoded text"
     );
@@ -228,7 +230,7 @@ diag "input a condition, select (several conditions), click delete";
     ok $agent->form_name('BuildQueryAdvanced'), "found the form";
     $agent->field("Query", "( Status = 'new' OR Status = 'open' )");
     $agent->submit;
-    is( getQueryFromForm,
+    is( getQueryFromForm($agent),
         "( Status = 'new' OR Status = 'open' )",
         "query is the same"
     );
@@ -236,7 +238,7 @@ diag "input a condition, select (several conditions), click delete";
     $agent->field( ValueOfid => 10 );
     $agent->click("DeleteClause");
 
-    is( getQueryFromForm,
+    is( getQueryFromForm($agent),
         "id < 10",
         "replaced query successfuly"
     );
@@ -247,7 +249,7 @@ diag "send query with not quoted negative number";
     my $response = $agent->get($url."Search/Build.html?Query=Priority%20>%20-2");
     ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
 
-    is( getQueryFromForm,
+    is( getQueryFromForm($agent),
         "Priority > -2",
         "query is the same"
     );

commit a41400702e47a3ede03dbab473ad4447b0146af3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 2 20:51:53 2010 +0800

    seems no need to stop_server here any more

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 1ae81ba..1f31ac0 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 45;
+use RT::Test tests => 47;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -56,10 +56,6 @@ $m->field('Hour' => '06:00');
 $m->click_button(name => 'Save');
 $m->content_contains("Subscribed to dashboard Testing!");
 
-# we're done with the web side; this silences some warnings about changing
-# the config as well
-RT::Test->stop_server;
-
 sub produces_dashboard_mail_ok { # {{{
     my %args = @_;
 

commit 3c31dd43f9d5175d2a629afe88b423e0729dfece
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Dec 2 21:02:30 2010 +0800

    no need to checkk @SERVERS

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index a77a8d7..775e362 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -340,7 +340,7 @@ sub custom_field_input {
 
 sub DESTROY {
     my $self = shift;
-    if ( @RT::Test::SERVERS && !$RT::Test::Web::DESTROY++ ) {
+    if ( !$RT::Test::Web::DESTROY++ ) {
         $self->no_warnings_ok;
     }
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list