[Rt-commit] rt branch, 4.4/test-warnings-destruction, created. rt-4.4.2-55-g0765de5

Alex Vandiver alexmv at bestpractical.com
Tue Nov 7 08:45:00 EST 2017


The branch, 4.4/test-warnings-destruction has been created
        at  0765de5208d0747a97afdd37ab8499063cf75ae9 (commit)

- Log -----------------------------------------------------------------
commit e9960b2e8ea52a3e21eb7372c04acd709429c659
Author: Alex Vandiver <alex at chmrr.net>
Date:   Mon Nov 6 15:13:09 2017 -0500

    Refcount RT::Test::Web, check for warnings on last destruction
    
    RT::Test::Web has logic that causes the _first_ destruction of it to
    check for warnings.  This is not the desired workflow -- the _last_
    destruction should be the one that triggers this behavior, in case
    there are multiple agents in use.  However, any such checks must
    happen before `done_testing` occurs, such that they are included in
    the total test count; `undef $m; done_testing` was used to force this.
    
    Begin refcounting RT::Test::Web, such that the release of the last
    object triggers checking for warnings.  Also explicitly trigger this
    in RT::Test's `done_testing`, and during global destruction.
    
    Any codepath which checks for warnings also undef's the refcount, such
    that it does not fire again during the clone/DESTROY which occurs in
    the course of checking for warnings.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 2eabbac..7ff4d68 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1772,6 +1772,12 @@ sub done_testing {
     Test::NoWarnings::had_no_warnings();
     $check_warnings_in_end = 0;
 
+    if ($RT::Test::Web::INSTANCES) {
+        my $cleanup = RT::Test::Web->new;
+        undef $RT::Test::Web::INSTANCES;
+        $cleanup->no_warnings_ok;
+    }
+
     $builder->done_testing(@_);
 }
 
diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 0f7d036..87070cd 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -52,21 +52,20 @@ use strict;
 use warnings;
 
 use base qw(Test::WWW::Mechanize);
-use Scalar::Util qw(weaken);
 use MIME::Base64 qw//;
 use Encode 'encode_utf8';
+use Storable 'thaw';
 
 BEGIN { require RT::Test; }
 require Test::More;
 
-my $instance;
+$RT::Test::Web::INSTANCES = undef;
 
 sub new {
     my ($class, @args) = @_;
 
     push @args, app => $RT::Test::TEST_APP if $RT::Test::TEST_APP;
-    my $self = $instance = $class->SUPER::new(@args);
-    weaken $instance;
+    my $self = $class->SUPER::new(@args);
     $self->cookie_jar(HTTP::Cookies->new);
     # Clear our caches of anything that the server process may have done
     $self->add_handler(
@@ -75,9 +74,16 @@ sub new {
         },
     ) if RT::Record->can( "FlushCache" );
 
+    $RT::Test::Web::INSTANCES++;
     return $self;
 }
 
+sub clone {
+    my $self = shift;
+    $RT::Test::Web::INSTANCES++ if defined $RT::Test::Web::INSTANCES;
+    return $self->SUPER::clone();
+}
+
 sub get_ok {
     my $self = shift;
     my $url = shift;
@@ -207,12 +213,9 @@ sub get_warnings {
     # forms on XYZ. This is because the most recently fetched page has changed
     # from XYZ to /__test_warnings, which has no form.
     my $clone = $self->clone;
-    return unless $clone->get_ok('/__test_warnings');
-
-    use Storable 'thaw';
 
-    my @warnings = @{ thaw $clone->content };
-    return @warnings;
+    return unless $clone->get_ok('/__test_warnings');
+    return @{ thaw $clone->content };
 }
 
 sub warning_like {
@@ -468,19 +471,27 @@ for my $method_name (qw/
 sub DESTROY {
     my $self = shift;
 
-    if ( RT::Test->builder->{Done_Testing} ) {
-        die "RT::Test::Web object needs to be destroyed before done_testing is called";
-    }
-
-    if ( !$RT::Test::Web::DESTROY++ ) {
-        $self->no_warnings_ok;
+    if (defined $RT::Test::Web::INSTANCES) {
+        $RT::Test::Web::INSTANCES--;
+        if ($RT::Test::Web::INSTANCES == 0 ) {
+            # Ordering matters -- clean out INSTANCES before we check
+            # warnings, so the clone therein sees that we've already begun
+            # cleanups.
+            undef $RT::Test::Web::INSTANCES;
+            $self->no_warnings_ok;
+        }
     }
 }
 
 END {
-    return unless $instance;
     return if RT::Test->builder->{Original_Pid} != $$;
-    $instance->no_warnings_ok if !$RT::Test::Web::DESTROY++;
+    if (defined $RT::Test::Web::INSTANCES and $RT::Test::Web::INSTANCES == 0 ) {
+        # Ordering matters -- clean out INSTANCES after the `new`
+        # bumps it up to 1.
+        my $cleanup = RT::Test::Web->new;
+        undef $RT::Test::Web::INSTANCES;
+        $cleanup->no_warnings_ok;
+    }
 }
 
 1;

commit 38813919e94adfa3fd8a3865474642f297dfa22f
Author: Alex Vandiver <alex at chmrr.net>
Date:   Tue Nov 7 08:36:40 2017 -0500

    Add missing warnings checks
    
    These warnings were previously triggering, but not caught because the
    "final" warnings check occurred after the first (not last) DESTROY of
    a RT::Test::Web object.  In this case, ironically, the RT::Test::Web
    object was the one created while fetching warnings.

diff --git a/t/externalauth/ldap.t b/t/externalauth/ldap.t
index ef48411..5c148ad 100644
--- a/t/externalauth/ldap.t
+++ b/t/externalauth/ldap.t
@@ -56,14 +56,15 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
 diag "test uri login";
 {
     ok( !$m->login( 'fakeuser', 'password' ), 'not logged in with fake user' );
+    $m->warning_like( qr/FAILED LOGIN for fakeuser/ );
     ok( $m->login( 'testuser', 'password' ), 'logged in' );
 }
 diag "test user creation";
 {
-my $testuser = RT::User->new($RT::SystemUser);
-my ($ok,$msg) = $testuser->Load( 'testuser' );
-ok($ok,$msg);
-is($testuser->EmailAddress,'testuser at invalid.tld');
+    my $testuser = RT::User->new($RT::SystemUser);
+    my ($ok,$msg) = $testuser->Load( 'testuser' );
+    ok($ok,$msg);
+    is($testuser->EmailAddress,'testuser at invalid.tld');
 }
 
 
@@ -94,8 +95,4 @@ diag "test redirect after login";
 
 $ldap->unbind();
 
-$m->get_warnings;
-
-undef $m;
-
 done_testing;
diff --git a/t/externalauth/ldap_privileged.t b/t/externalauth/ldap_privileged.t
index 7acdcc5..5444409 100644
--- a/t/externalauth/ldap_privileged.t
+++ b/t/externalauth/ldap_privileged.t
@@ -54,15 +54,16 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
 diag "test uri login";
 {
     ok( !$m->login( 'fakeuser', 'password' ), 'not logged in with fake user' );
+    $m->warning_like( qr/FAILED LOGIN for fakeuser/ );
     ok( $m->login( 'testuser', 'password' ), 'logged in' );
 }
 
 diag "test user creation";
 {
-my $testuser = RT::User->new($RT::SystemUser);
-my ($ok,$msg) = $testuser->Load( 'testuser' );
-ok($ok,$msg);
-is($testuser->EmailAddress,'testuser at invalid.tld');
+    my $testuser = RT::User->new($RT::SystemUser);
+    my ($ok,$msg) = $testuser->Load( 'testuser' );
+    ok($ok,$msg);
+    is($testuser->EmailAddress,'testuser at invalid.tld');
 }
 
 
@@ -81,8 +82,5 @@ like( $m->uri, qr!$baseurl/(index\.html)?!, 'privileged home page' );
 
 $ldap->unbind();
 
-$m->get_warnings;
-
-undef $m;
 done_testing;
 
diff --git a/t/externalauth/sqlite.t b/t/externalauth/sqlite.t
index 489aaef..d9d2d7d 100644
--- a/t/externalauth/sqlite.t
+++ b/t/externalauth/sqlite.t
@@ -63,16 +63,18 @@ my ( $baseurl, $m ) = RT::Test->started_ok();
 diag "test uri login";
 {
     ok( !$m->login( 'fakeuser', 'password' ), 'not logged in with fake user' );
+    $m->warning_like( qr/FAILED LOGIN for fakeuser/ );
     ok( !$m->login( 'testuser', 'wrongpassword' ), 'not logged in with wrong password' );
+    $m->warning_like( qr/FAILED LOGIN for testuser/ );
     ok( $m->login( 'testuser', 'password' ), 'logged in' );
 }
 
 diag "test user creation";
 {
-my $testuser = RT::User->new($RT::SystemUser);
-my ($ok,$msg) = $testuser->Load( 'testuser' );
-ok($ok,$msg);
-is($testuser->EmailAddress,'testuser at invalid.tld');
+    my $testuser = RT::User->new($RT::SystemUser);
+    my ($ok,$msg) = $testuser->Load( 'testuser' );
+    ok($ok,$msg);
+    is($testuser->EmailAddress,'testuser at invalid.tld');
 }
 
 diag "test form login";
@@ -108,8 +110,4 @@ diag "test with user and pass in URL";
     is( $m->uri, $baseurl . '/SelfService/Closed.html?user=testuser;pass=password' );
 }
 
-$m->get_warnings;
-
-undef $m;
-
 done_testing;

commit ab862b7765e5dfc9022b4966034c76bb8344de46
Author: Alex Vandiver <alex at chmrr.net>
Date:   Tue Nov 7 08:39:35 2017 -0500

    Remove test counts from files which now contain more tests
    
    These now properly trigger warnings fetches, thus increasing their
    test counts.  Switch to using `done_testing` rasther than hardcoded
    test counts.

diff --git a/t/ticket/clicky.t b/t/ticket/clicky.t
index 20d39a3..9cd2126 100644
--- a/t/ticket/clicky.t
+++ b/t/ticket/clicky.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use Test::More;
-use RT::Test tests => 20;
+use RT::Test tests => undef;
 
 my $plain = MIME::Entity->build(
     Subject => 'plain mime',
@@ -139,3 +139,4 @@ diag 'test httpurl_overwrite';
     ok( scalar @links, 'found clicky link with anchor' );
 }
 
+done_testing;
diff --git a/t/web/rest-sort.t b/t/web/rest-sort.t
index 5ddaa8e..a70688d 100644
--- a/t/web/rest-sort.t
+++ b/t/web/rest-sort.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use RT::Test tests => 25;
+use RT::Test tests => undef;
 
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -21,7 +21,7 @@ sorted_tickets_ok('id',  ['1: uno',  '2: dos', '3: tres']);
 sorted_tickets_ok('+id', ['1: uno',  '2: dos', '3: tres']);
 sorted_tickets_ok('-id', ['3: tres', '2: dos', '1: uno']);
 
-undef $m;
+done_testing;
 
 sub sorted_tickets_ok {
     local $Test::Builder::Level = $Test::Builder::Level + 1;
diff --git a/t/web/search_ical.t b/t/web/search_ical.t
index 094d8a2..e6a8332 100644
--- a/t/web/search_ical.t
+++ b/t/web/search_ical.t
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 
 use Data::ICal;
-use RT::Test tests => 77;
+use RT::Test tests => undef;
 
 my $start_obj = RT::Date->new( RT->SystemUser );
 $start_obj->SetToNow;
@@ -194,3 +194,5 @@ diag 'Test iCal with date and time using query param';
     is($prop_ref->{'dtend'}->[0]->value, $due, "Got due date with time: $due");
     like( $prop_ref->{'dtend'}->[0]->as_string, qr/VALUE=DATE-TIME\:/, 'Got DATE-TIME value');
 }
+
+done_testing;
diff --git a/t/web/ticket_seen.t b/t/web/ticket_seen.t
index e40782f..0fa4f7c 100644
--- a/t/web/ticket_seen.t
+++ b/t/web/ticket_seen.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test nodata => 1, tests => 23, config => 'Set($ShowUnreadMessageNotifications, 1);';
+use RT::Test nodata => 1, tests => undef, config => 'Set($ShowUnreadMessageNotifications, 1);';
 
 my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
 ok $queue && $queue->id, 'loaded or created queue';
@@ -93,3 +93,4 @@ diag "user B adds a message, we check that user A see notification and can clear
     );
 }
 
+done_testing;

commit 0ebae85e0578fae2f90d7df770970a5d3ca0c5c5
Author: Alex Vandiver <alex at chmrr.net>
Date:   Tue Nov 7 08:43:07 2017 -0500

    Remove now unnecessary `undef $m` lines

diff --git a/t/approval/admincc.t b/t/approval/admincc.t
index 1a5993b..fe313a7 100644
--- a/t/approval/admincc.t
+++ b/t/approval/admincc.t
@@ -279,8 +279,4 @@ $m_ceo->content_lacks( 'second approval', 'ceo: second approval is gone too' );
 
 RT::Test->clean_caught_mails;
 
-undef $m;
-undef $m_ceo;
-undef $m_coo;
-
 done_testing;
diff --git a/t/articles/class.t b/t/articles/class.t
index 7a7c015..abfeff6 100644
--- a/t/articles/class.t
+++ b/t/articles/class.t
@@ -81,5 +81,4 @@ $m->content_like(qr/Description changed from.*no value.*to .*Test Description/,'
 $m->form_number(3);
 is($m->current_form->find_input('Include-Name')->value,undef,'Disabled Including Names for this Class');
 
-undef $m;
 done_testing();
diff --git a/t/articles/search-interface.t b/t/articles/search-interface.t
index 3c75268..d604a99 100644
--- a/t/articles/search-interface.t
+++ b/t/articles/search-interface.t
@@ -143,7 +143,6 @@ TODO:{
     $m->text_contains('hoi polloi 4');
 }
 
-undef $m;
 done_testing;
 
 # When you send $m to this sub, it must be on a page with
diff --git a/t/articles/set-subject.t b/t/articles/set-subject.t
index 9b9ff85..5ba1af8 100644
--- a/t/articles/set-subject.t
+++ b/t/articles/set-subject.t
@@ -106,5 +106,5 @@ $m->submit_form(
     button      => 'Go',
 );
 is($m->form_number(3)->find_input('UpdateSubject')->value,$article->FirstCustomFieldValue("Subject-$$"),'Ticket Subject Clobbered');
-undef $m;
+
 done_testing;
diff --git a/t/assets/web.t b/t/assets/web.t
index 3595e26..67a8429 100644
--- a/t/assets/web.t
+++ b/t/assets/web.t
@@ -109,5 +109,4 @@ diag "Create with CFs in other groups";
 
 # XXX TODO: test other modify pages
 
-undef $m;
 done_testing;
diff --git a/t/customfields/ip.t b/t/customfields/ip.t
index 35a245c..96da6c3 100644
--- a/t/customfields/ip.t
+++ b/t/customfields/ip.t
@@ -286,5 +286,4 @@ diag "test the operators in search page" if $ENV{'TEST_VERBOSE'};
     is_deeply( [ $op->possible_values ], [ '=', '!=', '<', '>' ], 'op values' );
 }
 
-undef $agent;
 done_testing;
diff --git a/t/customfields/ipv6.t b/t/customfields/ipv6.t
index d1bca36..fdfd49c 100644
--- a/t/customfields/ipv6.t
+++ b/t/customfields/ipv6.t
@@ -248,5 +248,4 @@ diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd
     }
 }
 
-undef $agent;
 done_testing;
diff --git a/t/externalauth/ldap_escaping.t b/t/externalauth/ldap_escaping.t
index 34cb2a6..5598d60 100644
--- a/t/externalauth/ldap_escaping.t
+++ b/t/externalauth/ldap_escaping.t
@@ -102,5 +102,4 @@ diag "paren in the username";
 
 $ldap->unbind();
 
-undef $m;
 done_testing;
diff --git a/t/externalauth/ldap_group.t b/t/externalauth/ldap_group.t
index ebeea97..cc6b7bd 100644
--- a/t/externalauth/ldap_group.t
+++ b/t/externalauth/ldap_group.t
@@ -151,5 +151,4 @@ diag "test uri login";
 
 $ldap->unbind();
 
-undef $m;
 done_testing;
diff --git a/t/externalauth/obfuscate-password.t b/t/externalauth/obfuscate-password.t
index 286ad52..cd06045 100644
--- a/t/externalauth/obfuscate-password.t
+++ b/t/externalauth/obfuscate-password.t
@@ -31,6 +31,5 @@ $m->content_lacks('nottelling', 'external source 2 pass obfuscated');
 $m->content_contains('ldap_bind', 'sanity check: we do have external config dumped');
 $m->content_contains('external_db_user', 'sanity check: we do have external config dumped');
 
-undef $m;
 
 done_testing;
diff --git a/t/externalauth/sessions.t b/t/externalauth/sessions.t
index bb9416c..25cdd99 100644
--- a/t/externalauth/sessions.t
+++ b/t/externalauth/sessions.t
@@ -60,7 +60,6 @@ diag "Login as alex";
     sessions_seen_is($m, 4);
 }
 
-undef $m;
 done_testing;
 
 sub setup_auth_source {
diff --git a/t/i18n/caching.t b/t/i18n/caching.t
index f3d1b01..5db1f50 100644
--- a/t/i18n/caching.t
+++ b/t/i18n/caching.t
@@ -28,5 +28,3 @@ $m->get_ok( "/NoAuth/Logout.html" ); # ->logout fails because it's translated
 $m->login( root => "password" );
 $m->get_ok('/Prefs/Other.html');
 $m->content_lacks('Ne pas','Lacks translated french');
-
-undef $m;
diff --git a/t/i18n/default.t b/t/i18n/default.t
index d98828f..18bcf64 100644
--- a/t/i18n/default.t
+++ b/t/i18n/default.t
@@ -21,5 +21,3 @@ $m->content_contains( Encode::decode("UTF-8",'密碼'),
     local $TODO = "We fail to correctly advertise the langauage in the <html> block";
     $m->content_contains('<html lang="zh-tw">');
 }
-
-undef $m;
diff --git a/t/i18n/footer.t b/t/i18n/footer.t
index 5fb8ed4..a616371 100644
--- a/t/i18n/footer.t
+++ b/t/i18n/footer.t
@@ -25,4 +25,3 @@ $m->get_ok( "/NoAuth/Logout.html" ); # ->logout fails because it's translated
 $m->login( root => "password" );
 $m->content_contains('Copyright','Still has english copyright');
 
-undef $m;
diff --git a/t/lifecycles/basics.t b/t/lifecycles/basics.t
index 85e77c7..f53f077 100644
--- a/t/lifecycles/basics.t
+++ b/t/lifecycles/basics.t
@@ -242,5 +242,4 @@ diag "'!inactive -> inactive' actions are shown even if ticket has unresolved de
     );
 }
 
-undef $m;
 done_testing;
diff --git a/t/lifecycles/unresolved-deps.t b/t/lifecycles/unresolved-deps.t
index fe09d3b..8ec0f10 100644
--- a/t/lifecycles/unresolved-deps.t
+++ b/t/lifecycles/unresolved-deps.t
@@ -39,5 +39,4 @@ ok $m->login, 'logged in';
     );
 }
 
-undef $m;
 done_testing;
diff --git a/t/mail/dashboard-chart-with-utf8.t b/t/mail/dashboard-chart-with-utf8.t
index 4fe483a..cef5170 100644
--- a/t/mail/dashboard-chart-with-utf8.t
+++ b/t/mail/dashboard-chart-with-utf8.t
@@ -83,5 +83,4 @@ if ( my $io = $handle->open('r') ) {
 }
 is( $mail_image_data, $image, 'image in mail is the same one in web' );
 
-undef $m;
 done_testing;
diff --git a/t/mail/dashboard-empty.t b/t/mail/dashboard-empty.t
index 91ec031..dcb7020 100644
--- a/t/mail/dashboard-empty.t
+++ b/t/mail/dashboard-empty.t
@@ -127,6 +127,5 @@ ok($ok, $msg);
     ok($contents[2] =~ qr/a computer asset/);
 }
 
-undef $m;
 done_testing;
 
diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index fde81c6..05ae73c 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -426,5 +426,4 @@ produces_no_dashboard_mail_ok(
     Time    => $bad_time,
 );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index b8a8b46..c51daa9 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -807,7 +807,4 @@ ok( $user->HasRight( Right => 'ReplyToTicket', Object => $tick ), "owner can rep
 # +2 from take, +1 from correspond
 is( $tick->Transactions->Count, 6, "transactions added" );
 
-$m->no_warnings_ok;
-
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-encrypted-plaintext.t b/t/mail/gnupg-outgoing-encrypted-plaintext.t
index 7f0f7ac..9507ff4 100644
--- a/t/mail/gnupg-outgoing-encrypted-plaintext.t
+++ b/t/mail/gnupg-outgoing-encrypted-plaintext.t
@@ -25,5 +25,4 @@ ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-encrypted.t b/t/mail/gnupg-outgoing-encrypted.t
index dc6a55d..802830f 100644
--- a/t/mail/gnupg-outgoing-encrypted.t
+++ b/t/mail/gnupg-outgoing-encrypted.t
@@ -24,5 +24,4 @@ ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-plain-plaintext.t b/t/mail/gnupg-outgoing-plain-plaintext.t
index baf51e4..a9a68ce 100644
--- a/t/mail/gnupg-outgoing-plain-plaintext.t
+++ b/t/mail/gnupg-outgoing-plain-plaintext.t
@@ -23,5 +23,4 @@ my ( $baseurl, $m ) = RT::Test->started_ok;
 ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-plain.t b/t/mail/gnupg-outgoing-plain.t
index f8f87e1..d1cd301 100644
--- a/t/mail/gnupg-outgoing-plain.t
+++ b/t/mail/gnupg-outgoing-plain.t
@@ -22,5 +22,4 @@ my ( $baseurl, $m ) = RT::Test->started_ok;
 ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-signed-plaintext.t b/t/mail/gnupg-outgoing-signed-plaintext.t
index 0ff06d1..e516762 100644
--- a/t/mail/gnupg-outgoing-signed-plaintext.t
+++ b/t/mail/gnupg-outgoing-signed-plaintext.t
@@ -25,5 +25,4 @@ ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-signed.t b/t/mail/gnupg-outgoing-signed.t
index 00d292a..b7119a1 100644
--- a/t/mail/gnupg-outgoing-signed.t
+++ b/t/mail/gnupg-outgoing-signed.t
@@ -24,5 +24,4 @@ ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t b/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t
index b21b344..946fa76 100644
--- a/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t
+++ b/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t
@@ -26,5 +26,4 @@ ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-outgoing-signed_encrypted.t b/t/mail/gnupg-outgoing-signed_encrypted.t
index 1399c57..61cf6b2 100644
--- a/t/mail/gnupg-outgoing-signed_encrypted.t
+++ b/t/mail/gnupg-outgoing-signed_encrypted.t
@@ -25,5 +25,4 @@ ok $m->login, 'logged in';
 
 create_and_test_outgoing_emails( $queue, $m );
 
-undef $m;
 done_testing;
diff --git a/t/mail/gnupg-reverification.t b/t/mail/gnupg-reverification.t
index 06c2e0d..e5dcf09 100644
--- a/t/mail/gnupg-reverification.t
+++ b/t/mail/gnupg-reverification.t
@@ -87,5 +87,4 @@ foreach my $id ( @ticket_ids ) {
     $m->no_warnings_ok;
 }
 
-undef $m;
 done_testing;
diff --git a/t/mail/rfc2231-attachment.t b/t/mail/rfc2231-attachment.t
index 9610961..94903b6 100644
--- a/t/mail/rfc2231-attachment.t
+++ b/t/mail/rfc2231-attachment.t
@@ -22,6 +22,5 @@ diag "encoded attachment filename with parameter continuations";
     $m->content_contains(Encode::decode("UTF-8","新しいテキスト ドキュメント.txt"), "found full filename");
 }
 
-undef $m;
 done_testing;
 
diff --git a/t/mail/smime/incoming.t b/t/mail/smime/incoming.t
index 918844a..07897ee 100644
--- a/t/mail/smime/incoming.t
+++ b/t/mail/smime/incoming.t
@@ -198,5 +198,4 @@ RT::Test->close_mailgate_ok($mail);
 
 }
 
-undef $m;
 done_testing;
diff --git a/t/mail/smime/outgoing.t b/t/mail/smime/outgoing.t
index 6f6b00d..a90c4cb 100644
--- a/t/mail/smime/outgoing.t
+++ b/t/mail/smime/outgoing.t
@@ -76,5 +76,4 @@ END
     like($buf, qr'This message has been automatically generated in response');
 }
 
-undef $m;
 done_testing;
diff --git a/t/mail/smime/realmail.t b/t/mail/smime/realmail.t
index be157aa..13c9a51 100644
--- a/t/mail/smime/realmail.t
+++ b/t/mail/smime/realmail.t
@@ -42,7 +42,6 @@ for my $usage (qw/signed encrypted signed&encrypted/) {
     }
 }
 
-undef $m;
 done_testing;
 
 sub email_ok {
diff --git a/t/mail/smime/reject_on_unencrypted.t b/t/mail/smime/reject_on_unencrypted.t
index 60223ea..3d35e4f 100644
--- a/t/mail/smime/reject_on_unencrypted.t
+++ b/t/mail/smime/reject_on_unencrypted.t
@@ -133,5 +133,4 @@ RT::Test->close_mailgate_ok($mail);
     like( $attach->Content, qr'orzzzz');
 }
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-2083-cf-urls.t b/t/security/CVE-2011-2083-cf-urls.t
index b1e1f3b..4583c74 100644
--- a/t/security/CVE-2011-2083-cf-urls.t
+++ b/t/security/CVE-2011-2083-cf-urls.t
@@ -44,5 +44,4 @@ ok !$m->find_link(url  => $data_uri), "no data: link";
 $m->content_lacks($xss, 'escaped js');
 
 $m->warning_like(qr/Potentially dangerous URL type/, "found warning about dangerous link");
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-2083-clickable-xss.t b/t/security/CVE-2011-2083-clickable-xss.t
index 753d8c7..e0d5aab 100644
--- a/t/security/CVE-2011-2083-clickable-xss.t
+++ b/t/security/CVE-2011-2083-clickable-xss.t
@@ -47,5 +47,4 @@ for my $link ( map { ($_, ucfirst $_) } @links ) {
 
 $m->no_leftover_warnings_ok;
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-2084-attach-tickets.t b/t/security/CVE-2011-2084-attach-tickets.t
index d7352cb..3d189cb 100644
--- a/t/security/CVE-2011-2084-attach-tickets.t
+++ b/t/security/CVE-2011-2084-attach-tickets.t
@@ -59,6 +59,5 @@ my @mail = RT::Test->fetch_caught_mails;
 ok @mail, "got some outgoing emails";
 unlike $mail[0], qr/\Q$secret\E/, "doesn't contain ticket user can't see";
 
-undef $m;
 done_testing;
 
diff --git a/t/security/CVE-2011-2084-cf-values.t b/t/security/CVE-2011-2084-cf-values.t
index 21c8547..5bd9f20 100644
--- a/t/security/CVE-2011-2084-cf-values.t
+++ b/t/security/CVE-2011-2084-cf-values.t
@@ -128,5 +128,4 @@ is_deeply ac( Context => $queue ), [], 'queue context is not enough';
 is_deeply ac( Context => $ticket ), $cfvalues, 'ticket context, get values';
 
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-2084-transactions.t b/t/security/CVE-2011-2084-transactions.t
index 817288d..361586c 100644
--- a/t/security/CVE-2011-2084-transactions.t
+++ b/t/security/CVE-2011-2084-transactions.t
@@ -55,5 +55,4 @@ $m->post_ok("$base/REST/1.0/transaction/$update_id", [
 ]);
 $m->content_lacks("hidden-value");
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-4460-rows-per-page.t b/t/security/CVE-2011-4460-rows-per-page.t
index 0623408..562ab05 100644
--- a/t/security/CVE-2011-4460-rows-per-page.t
+++ b/t/security/CVE-2011-4460-rows-per-page.t
@@ -28,5 +28,4 @@ $m->get_ok("$base/Search/Results.html?Format=id,Subject,Status;Query=id%3E0;Orde
 $m->content_lacks($password, "our password hash doesn't show up!");
 $m->warning_like(qr/isn't numeric/);
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-5092-datetimeformat.t b/t/security/CVE-2011-5092-datetimeformat.t
index 470f4f4..4af6af6 100644
--- a/t/security/CVE-2011-5092-datetimeformat.t
+++ b/t/security/CVE-2011-5092-datetimeformat.t
@@ -44,5 +44,4 @@ $m->get_ok("$base/Ticket/Display.html?id=" . $ticket->id);
 $m->next_warning_like(qr/Invalid date formatter.+?\Q$format\E/, 'invalid formatter warning');
 $m->content_lacks($_, "lacks formatter in page") for @RT::Date::FORMATTERS;
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-5092-graph-links.t b/t/security/CVE-2011-5092-graph-links.t
index 660a3f4..c32ad90 100644
--- a/t/security/CVE-2011-5092-graph-links.t
+++ b/t/security/CVE-2011-5092-graph-links.t
@@ -26,5 +26,4 @@ for my $arg (qw(LeadingLink ShowLinks)) {
     $m->content_like(qr|<img[^>]+?src=['"]/Ticket/Graphs/@{[$ticket->id]}|, 'found image element');
 }
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-5092-installmode.t b/t/security/CVE-2011-5092-installmode.t
index ce88a4f..88624f4 100644
--- a/t/security/CVE-2011-5092-installmode.t
+++ b/t/security/CVE-2011-5092-installmode.t
@@ -20,5 +20,4 @@ warning_like {
 $m->reload;
 $m->content_like(qr/RT at a glance/i, 'still homepage');
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2011-5092-prefs.t b/t/security/CVE-2011-5092-prefs.t
index b8e15aa..347de7b 100644
--- a/t/security/CVE-2011-5092-prefs.t
+++ b/t/security/CVE-2011-5092-prefs.t
@@ -73,5 +73,4 @@ $m->login('ausername');
     $m->content_contains('Results.html', "found link to search results");
 }
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2012-4732-csrf-blacklist.t b/t/security/CVE-2012-4732-csrf-blacklist.t
index 51d7412..43652e4 100644
--- a/t/security/CVE-2012-4732-csrf-blacklist.t
+++ b/t/security/CVE-2012-4732-csrf-blacklist.t
@@ -38,5 +38,4 @@ $m->content_lacks("Possible cross-site request forgery");
 like($m->response->request->uri, qr{^http://[^/]+\Q$test_path\E\?CSRF_Token=\w+$});
 $m->content_contains("star-empty.png");
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2012-4733-status.t b/t/security/CVE-2012-4733-status.t
index 7b89268..66fccd2 100644
--- a/t/security/CVE-2012-4733-status.t
+++ b/t/security/CVE-2012-4733-status.t
@@ -22,5 +22,4 @@ is($ticket->Status, 'resolved', "Status is now resolved");
 ($ok, $msg) = $ticket->SetStatus('open');
 ok($ok, "Can set status back to open");
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2012-4734-login-warning.t b/t/security/CVE-2012-4734-login-warning.t
index 3dd21cd..e426915 100644
--- a/t/security/CVE-2012-4734-login-warning.t
+++ b/t/security/CVE-2012-4734-login-warning.t
@@ -26,5 +26,4 @@ $m->content_contains('Owner changed from Nobody to root');
 $ticket->Load($ticket->Id);
 is($ticket->OwnerObj->Name,'root',"Ticket was assigned to root");
 
-undef $m;
 done_testing;
diff --git a/t/security/CVE-2012-4735-sign-any-key.t b/t/security/CVE-2012-4735-sign-any-key.t
index 0a28b8c..248df9c 100644
--- a/t/security/CVE-2012-4735-sign-any-key.t
+++ b/t/security/CVE-2012-4735-sign-any-key.t
@@ -90,5 +90,4 @@ $m->content_lacks("unable to sign outgoing email messages");
 is( scalar @mail, 1, "Sent a mail" );
 like( $mail[0], qr/BEGIN PGP SIGNATURE/, "Is signed" );
 
-undef $m;
 done_testing;
diff --git a/t/sla/web.t b/t/sla/web.t
index 44f20d7..2a9f27f 100644
--- a/t/sla/web.t
+++ b/t/sla/web.t
@@ -104,5 +104,4 @@ ok $m->login( 'user', 'password' ), 'logged in as user';
     ok( !$ticket->DueObj->Unix,    'no Due' );
 }
 
-undef $m;
-done_testing();
+done_testing;
diff --git a/t/web/action-results.t b/t/web/action-results.t
index db8c26b..1cd1b1f 100644
--- a/t/web/action-results.t
+++ b/t/web/action-results.t
@@ -44,5 +44,4 @@ for my $quick (1, 0) {
     }
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/admin_user.t b/t/web/admin_user.t
index dc984eb..04b13a9 100644
--- a/t/web/admin_user.t
+++ b/t/web/admin_user.t
@@ -76,5 +76,4 @@ is( $form->find_input('PrivateKey')->value,
 
 # TODO more /Admin/Users tests
 
-undef $m;
 done_testing;
diff --git a/t/web/attachment_dropping.t b/t/web/attachment_dropping.t
index 466f7a0..80a7c6f 100644
--- a/t/web/attachment_dropping.t
+++ b/t/web/attachment_dropping.t
@@ -48,5 +48,4 @@ $m->content_lacks( 'cfaaaa', 'cf value was dropped' );
 $m->follow_link_ok( { text => "Download $name" } );
 is( $m->content, 'Large attachment dropped', 'dropped $name' );
 
-undef $m;
 done_testing;
diff --git a/t/web/attachment_truncation.t b/t/web/attachment_truncation.t
index b60f29e..1a2356b 100644
--- a/t/web/attachment_truncation.t
+++ b/t/web/attachment_truncation.t
@@ -49,5 +49,4 @@ $m->follow_link_ok( { text => "Download $name" } );
 $m->content_contains( 'a' x 1000, 'has the first 1000 chars' );
 $m->content_lacks( 'b', 'lacks chars after that' );
 
-undef $m;
 done_testing;
diff --git a/t/web/attachments.t b/t/web/attachments.t
index 286acd0..d03d0a0 100644
--- a/t/web/attachments.t
+++ b/t/web/attachments.t
@@ -518,6 +518,4 @@ diag "update and create";
     $m2->content_lacks('Download favicon.png', 'page has no file name');
 }
 
-undef $m;
-undef $m2;
-done_testing();
+done_testing;
diff --git a/t/web/cf_date.t b/t/web/cf_date.t
index 1e890c3..b3b7dcc 100644
--- a/t/web/cf_date.t
+++ b/t/web/cf_date.t
@@ -279,5 +279,4 @@ diag 'retain values when adding attachments';
         "2015-12-16", "txn date value still on form" );
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index a3cd5be..0445553 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -328,7 +328,4 @@ sub is_results_number {
     $m->content_contains( "Found $number ticket", "Found $number ticket" );
 }
 
-# to make $m->DESTROY happy
-undef $m;
-
 done_testing;
diff --git a/t/web/cf_groupings.t b/t/web/cf_groupings.t
index 03ca60a..a872617 100644
--- a/t/web/cf_groupings.t
+++ b/t/web/cf_groupings.t
@@ -273,5 +273,4 @@ my $prefix = 'Object-RT::Ticket-'. $id .'-CustomField:';
         "Multi-select values submitted correctly";
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_groupings_user.t b/t/web/cf_groupings_user.t
index fe79ae5..b145071 100644
--- a/t/web/cf_groupings_user.t
+++ b/t/web/cf_groupings_user.t
@@ -106,5 +106,4 @@ ok $id, "found user's id #$id";
     }
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_image.t b/t/web/cf_image.t
index 3b72dad..7c294b8 100644
--- a/t/web/cf_image.t
+++ b/t/web/cf_image.t
@@ -58,5 +58,4 @@ $m->tick("Object-RT::Ticket-1-CustomField-2-DeleteValueIds", 1);
 $m->click_ok("SubmitTicket");
 $m->content_lacks("/Download/CustomFieldValue/1/bpslogo.png");
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_pattern.t b/t/web/cf_pattern.t
index ff85ec6..95fae50 100644
--- a/t/web/cf_pattern.t
+++ b/t/web/cf_pattern.t
@@ -76,5 +76,4 @@ diag "Quick ticket creation";
     $m->content_contains("test quick create", "Found prefilled Subject");
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index ce11833..7fa13a2 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -185,5 +185,4 @@ diag 'retain selected cf values when adding attachments';
        "Selected value still on form" );
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_set_initial.t b/t/web/cf_set_initial.t
index f267bed..0cf4f68 100644
--- a/t/web/cf_set_initial.t
+++ b/t/web/cf_set_initial.t
@@ -104,5 +104,4 @@ diag "check that we have the CF on the create"
     $m->content_lacks('Multi Set Initial CF', 'has no CF edit field');
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/cf_textarea.t b/t/web/cf_textarea.t
index 444020e..50b00c5 100644
--- a/t/web/cf_textarea.t
+++ b/t/web/cf_textarea.t
@@ -82,5 +82,4 @@ $m->content_lacks("<li>TheTextarea $content changed to $content</li>", 'textarea
 # #32440: Spurious "CF changed from 0 to 0"
 $m->content_lacks("<li>Zero 0 changed to 0</li>", "Zero wasn't updated");
 
-undef $m;
 done_testing;
diff --git a/t/web/charting.t b/t/web/charting.t
index 5131f9c..0b0329c 100644
--- a/t/web/charting.t
+++ b/t/web/charting.t
@@ -94,5 +94,4 @@ like( $advanced, qr{Query=id%3E0},
       'Advanced link still has Query param with id search'
     );
 
-undef $m;
 done_testing;
diff --git a/t/web/command_line.t b/t/web/command_line.t
index 47f6728..b5b1e88 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -602,7 +602,6 @@ sub check_attachment {
 my @warnings = grep { $_ !~ /\$ampm/ } $m->get_warnings;
 is( scalar @warnings, 0, 'no extra warnings' );
 
-undef $m;
 done_testing;
 
 1; # needed to avoid a weird exit value from expect_quit
diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index 995b45d..790225c 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -462,5 +462,4 @@ $m->next_warning_like(qr/public key not found/);
 $m->next_warning_like(qr/public key not found/);
 $m->no_leftover_warnings_ok;
 
-undef $m;
 done_testing;
diff --git a/t/web/csrf-rest.t b/t/web/csrf-rest.t
index d909c4a..25d87b1 100644
--- a/t/web/csrf-rest.t
+++ b/t/web/csrf-rest.t
@@ -71,6 +71,5 @@ $m->content_lacks("RT at a glance", "Full UI is denied for REST sessions");
 $m->content_contains("This login session belongs to a REST client", "Tells you why");
 $m->warning_like(qr/This login session belongs to a REST client/, "Logs a warning");
 
-undef $m;
 done_testing;
 
diff --git a/t/web/csrf.t b/t/web/csrf.t
index 3a3127c..d693b55 100644
--- a/t/web/csrf.t
+++ b/t/web/csrf.t
@@ -225,5 +225,4 @@ like($m->response->request->uri, qr{^http://[^/]+\Q/SelfService/Create.html\E\?C
 $m->title_is('Create a ticket in #1');
 $m->content_contains('Describe the issue below:');
 
-undef $m;
 done_testing;
diff --git a/t/web/dashboards-in-menu.t b/t/web/dashboards-in-menu.t
index 8333313..3915bb2 100644
--- a/t/web/dashboards-in-menu.t
+++ b/t/web/dashboards-in-menu.t
@@ -99,5 +99,4 @@ $m->click_button(name => 'Delete');
 $m->get_ok( $baseurl . "/Dashboards/index.html" );
 $m->content_lacks('system foo', 'Dashboard is deleted');
 
-undef $m;
 done_testing;
diff --git a/t/web/dashboards-subscription.t b/t/web/dashboards-subscription.t
index 502650b..fadc254 100644
--- a/t/web/dashboards-subscription.t
+++ b/t/web/dashboards-subscription.t
@@ -125,5 +125,4 @@ $m->content_contains('customers test group removed from dashboard subscription r
 $m->follow_link_ok({ id => 'page-subscription' });
 $m->content_lacks('customers test group');
 
-undef $m;
 done_testing;
diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index c0ded96..2b9a680 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -278,5 +278,4 @@ for my $encrypt (0, 1) {
     $m->no_warnings_ok;
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index d7a315f..2f31a0f 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -299,5 +299,4 @@ for my $encrypt (0, 1) {
     $m->no_warnings_ok;
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/helpers-http-cache-headers.t b/t/web/helpers-http-cache-headers.t
index 926ec95..1ffef2d 100644
--- a/t/web/helpers-http-cache-headers.t
+++ b/t/web/helpers-http-cache-headers.t
@@ -102,5 +102,4 @@ foreach my $endpoint ( @endpoints ) {
   );
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/html_template.t b/t/web/html_template.t
index 108d83f..1dbe66b 100644
--- a/t/web/html_template.t
+++ b/t/web/html_template.t
@@ -67,5 +67,4 @@ diag('test real mail outgoing') if $ENV{TEST_VERBOSE};
     like( $mail, qr!<h1>$content</h1>!,     'mail has ticket html content <h1>$content</h1>' );
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/install.t b/t/web/install.t
index e33e58b..5acea50 100644
--- a/t/web/install.t
+++ b/t/web/install.t
@@ -169,5 +169,4 @@ is( $config->Get('CommentAddress'), $comment, 'comment address in config' );
 
 unlink File::Spec->catfile( $RT::VarPath, $dbname );
 
-undef $m;
 done_testing;
diff --git a/t/web/installer.t b/t/web/installer.t
index a690e1a..900a4d7 100644
--- a/t/web/installer.t
+++ b/t/web/installer.t
@@ -102,5 +102,4 @@ diag "Walking through install screens setting defaults";
 }
 
 RT::Test::__drop_database();
-undef $m;
 done_testing;
diff --git a/t/web/make-clicky.t b/t/web/make-clicky.t
index 43f4249..8a9446c 100644
--- a/t/web/make-clicky.t
+++ b/t/web/make-clicky.t
@@ -86,5 +86,4 @@ sub make_clicky {
     return $m->success ? $m->content : "";
 }
 
-undef $m;
 done_testing();
diff --git a/t/web/owner_disabled_group_19221.t b/t/web/owner_disabled_group_19221.t
index b71fc5b..74297a5 100644
--- a/t/web/owner_disabled_group_19221.t
+++ b/t/web/owner_disabled_group_19221.t
@@ -185,5 +185,4 @@ diag "Check MemberOfGroup";
 }
 
 
-undef $m;
 done_testing;
diff --git a/t/web/path-traversal.t b/t/web/path-traversal.t
index 8207265..2a81d98 100644
--- a/t/web/path-traversal.t
+++ b/t/web/path-traversal.t
@@ -46,5 +46,4 @@ is($agent->status, 200);
 $agent->get("$baseurl/index.html#/.");
 is($agent->status, 200);
 
-undef $agent;
 done_testing;
diff --git a/t/web/plugin-overlays.t b/t/web/plugin-overlays.t
index fec4589..aaaf94f 100644
--- a/t/web/plugin-overlays.t
+++ b/t/web/plugin-overlays.t
@@ -26,5 +26,4 @@ ok $m->content, "Received some content";
 my $info = from_json($m->content) || {};
 ok $info->{Comments}{public}, "User.Comments is marked public via overlay";
 
-undef $m;
 done_testing;
diff --git a/t/web/psgi-wrap.t b/t/web/psgi-wrap.t
index 0e4b053..ecbe74a 100644
--- a/t/web/psgi-wrap.t
+++ b/t/web/psgi-wrap.t
@@ -11,5 +11,4 @@ ok(my $res = $m->get("/"));
 is($res->code, 200, 'Successful request to /');
 ok($res->header('X-RT-PSGIWrap'), 'X-RT-PSGIWrap header set from the plugin');
 
-undef $m;
 done_testing();
diff --git a/t/web/rest-search-group.t b/t/web/rest-search-group.t
index b62aa09..d744ef5 100644
--- a/t/web/rest-search-group.t
+++ b/t/web/rest-search-group.t
@@ -98,5 +98,4 @@ sub search_groups_ok {
 
 }
 
-undef $m;
-done_testing();
+done_testing;
diff --git a/t/web/rest-search-queue.t b/t/web/rest-search-queue.t
index a827d86..46e82ad 100644
--- a/t/web/rest-search-queue.t
+++ b/t/web/rest-search-queue.t
@@ -100,5 +100,4 @@ sub search_queues_ok {
 
 }
 
-undef $m;
-done_testing();
+done_testing;
diff --git a/t/web/rest-search-user.t b/t/web/rest-search-user.t
index 84a9673..dc0d2f3 100644
--- a/t/web/rest-search-user.t
+++ b/t/web/rest-search-user.t
@@ -111,5 +111,4 @@ sub search_users_ok {
 
 }
 
-undef $m;
-done_testing();
+done_testing;
diff --git a/t/web/rest_user_cf.t b/t/web/rest_user_cf.t
index c74ac07..5a671d4 100644
--- a/t/web/rest_user_cf.t
+++ b/t/web/rest_user_cf.t
@@ -22,5 +22,4 @@ ok( $m->login, 'logged in' );
 $m->post( "$baseurl/REST/1.0/show", [ id => 'user/14', ] );
 like( $m->content, qr/CF-foo: blabla/, 'found the cf' );
 
-undef $m;
 done_testing;
diff --git a/t/web/rights.t b/t/web/rights.t
index 8f44639..ec43b81 100644
--- a/t/web/rights.t
+++ b/t/web/rights.t
@@ -267,5 +267,4 @@ test_system_internal_queue_role ( 'General', 'Cc', 'ModifyScrips' );
 test_system_internal_queue_role ( 'General', 'Owner', 'ForwardMessage' );
 test_system_internal_queue_role ( 'General', 'Requestor', 'SeeQueue' );
 
-undef $m;
 done_testing;
diff --git a/t/web/saved_search_chart.t b/t/web/saved_search_chart.t
index e964a8f..27e64b6 100644
--- a/t/web/saved_search_chart.t
+++ b/t/web/saved_search_chart.t
@@ -189,5 +189,4 @@ diag "saving a chart without changing its config shows up on dashboards (I#31557
     is_deeply($search->GetParameter('ChartFunction'), ['COUNT'], 'chart correctly initialized with default ChartFunction');
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/scrips.t b/t/web/scrips.t
index d669f4c..1e9ee4e 100644
--- a/t/web/scrips.t
+++ b/t/web/scrips.t
@@ -296,5 +296,4 @@ note "apply scrip in different stage to different queues";
     is scalar @matches, 1, 'scrip mentioned only once';
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/search_linkdisplay.t b/t/web/search_linkdisplay.t
index 2d525df..8d18f54 100644
--- a/t/web/search_linkdisplay.t
+++ b/t/web/search_linkdisplay.t
@@ -59,5 +59,4 @@ $ref = $m->find_link( url_regex => qr!/Article/Display.html! );
 ok( $ref, "found article link" );
 is( $ref->text, $article->URIObj->Resolver->AsString, $article->URIObj->Resolver->AsString . " is displayed" );
 
-undef $m;
 done_testing;
diff --git a/t/web/signatures.t b/t/web/signatures.t
index 919e1e6..72f9bb1 100644
--- a/t/web/signatures.t
+++ b/t/web/signatures.t
@@ -155,5 +155,4 @@ subtest "HTML, reply, before quote" => sub {
     ) };
 
 
-undef $m;
 done_testing;
diff --git a/t/web/simple_search.t b/t/web/simple_search.t
index 41ba6a4..0a9c2c0 100644
--- a/t/web/simple_search.t
+++ b/t/web/simple_search.t
@@ -219,5 +219,4 @@ for my $quote ( q{'}, q{"} ) {
     }
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/smime/outgoing.t b/t/web/smime/outgoing.t
index 21d2328..2f80c7e 100644
--- a/t/web/smime/outgoing.t
+++ b/t/web/smime/outgoing.t
@@ -298,7 +298,6 @@ sub update_ticket {
     check_text_emails( \%args, @mail );
 }
 
-undef $m;
 done_testing;
 
 sub check_text_emails {
diff --git a/t/web/squish.t b/t/web/squish.t
index 77745d8..1b97cc4 100644
--- a/t/web/squish.t
+++ b/t/web/squish.t
@@ -71,5 +71,4 @@ $m->content_contains('not-by-default.js', "found extra javascript resource");
 $m->content_contains('nottherebutwedontcare.css', "found extra css resource");
 $m->content_contains('jquery_noconflict.js', "found a default js resource");
 
-undef $m;
 done_testing;
diff --git a/t/web/ticket_display.t b/t/web/ticket_display.t
index 35e9217..33336d7 100644
--- a/t/web/ticket_display.t
+++ b/t/web/ticket_display.t
@@ -65,5 +65,4 @@ diag "test ShowTicket right";
 }
 
 
-undef $m;
 done_testing();
diff --git a/t/web/ticket_display_unset_fields.t b/t/web/ticket_display_unset_fields.t
index 89044e2..b047edc 100644
--- a/t/web/ticket_display_unset_fields.t
+++ b/t/web/ticket_display_unset_fields.t
@@ -117,5 +117,4 @@ diag "Test unset custom fields";
     isnt $dom->find(qq{tr.customfield.unset-field})->size, 1, "no unset custom fields";
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/ticket_forward.t b/t/web/ticket_forward.t
index 439242d..c0c740e 100644
--- a/t/web/ticket_forward.t
+++ b/t/web/ticket_forward.t
@@ -280,5 +280,4 @@ diag "Forward Transaction with non-ascii subject" if $ENV{TEST_VERBOSE};
     $m->content_contains( $subject, 'non-ascii subject got displayed correctly' );
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/ticket_modify_all.t b/t/web/ticket_modify_all.t
index 22470df..6605236 100644
--- a/t/web/ticket_modify_all.t
+++ b/t/web/ticket_modify_all.t
@@ -114,5 +114,4 @@ $m->text_contains('Adjusted time worked by -120 minutes');
 $m->form_name('TicketModifyAll');
 is($m->value('TimeWorked'), "", 'no time worked');
 
-undef $m;
 done_testing;
diff --git a/t/web/ticket_owner.t b/t/web/ticket_owner.t
index 782e68f..abce05a 100644
--- a/t/web/ticket_owner.t
+++ b/t/web/ticket_owner.t
@@ -517,8 +517,4 @@ diag "user can take/steal ticket with ReassignTicket+OwnTicket right";
     ok !($agent_c->find_all_links( text => 'Steal' ))[0], 'no Steal link';
 }
 
-
-undef $agent_a;
-undef $agent_b;
-undef $agent_c;
 done_testing;
diff --git a/t/web/ticket_preserve_basics.t b/t/web/ticket_preserve_basics.t
index 0220345..db95ee3 100644
--- a/t/web/ticket_preserve_basics.t
+++ b/t/web/ticket_preserve_basics.t
@@ -106,5 +106,4 @@ for my $try (@form_tries) {
     }
 }
 
-undef $m;
 done_testing();
diff --git a/t/web/ticket_timeworked.t b/t/web/ticket_timeworked.t
index 974fa53..3e8ddf6 100644
--- a/t/web/ticket_timeworked.t
+++ b/t/web/ticket_timeworked.t
@@ -146,5 +146,4 @@ diag "checking child ticket 2 for expected timeworked data"; {
     );
 }
 
-undef $m;
 done_testing();
diff --git a/t/web/ticket_txn_cf.t b/t/web/ticket_txn_cf.t
index f902742..42a3772 100644
--- a/t/web/ticket_txn_cf.t
+++ b/t/web/ticket_txn_cf.t
@@ -119,6 +119,5 @@ diag 'submit no value on ticket update page';
         0, 'no txn cf value in db' );
 }
 
-undef $m;
 done_testing;
 
diff --git a/t/web/ticket_txn_subject.t b/t/web/ticket_txn_subject.t
index a43f05d..553c0b5 100644
--- a/t/web/ticket_txn_subject.t
+++ b/t/web/ticket_txn_subject.t
@@ -81,5 +81,4 @@ for my $tid (@tickets) {
     }
 }
 
-undef $m;
 done_testing;
diff --git a/t/web/user_update.t b/t/web/user_update.t
index 7be088b..b10fb2b 100644
--- a/t/web/user_update.t
+++ b/t/web/user_update.t
@@ -35,5 +35,4 @@ $m->submit_form_ok({ with_fields => { Lang => ''} },
 $m->text_contains("Lang changed from 'ja' to (no value)");
 $m->text_contains("Real Name", "Page content is english");
 
-undef $m;
 done_testing;

commit 0765de5208d0747a97afdd37ab8499063cf75ae9
Author: Alex Vandiver <alex at chmrr.net>
Date:   Tue Nov 7 08:44:15 2017 -0500

    Add missing commas, propagated by copy/paste

diff --git a/t/charts/compound-sql-function.t b/t/charts/compound-sql-function.t
index 3e6a3fd..475516b 100644
--- a/t/charts/compound-sql-function.t
+++ b/t/charts/compound-sql-function.t
@@ -107,7 +107,7 @@ sub add_tix_from_data {
         $resolved->Set( Value => $created->Unix );
         $resolved->AddSeconds( $data[0]{'Resolved'} );
         my $t = RT::Ticket->new($RT::SystemUser);
-        my ( $id, undef $msg ) = $t->Create(
+        my ( $id, undef, $msg ) = $t->Create(
             %{ shift(@data) },
             Created => $created->ISO,
             Resolved => $resolved->ISO,
diff --git a/t/ticket/requestor-order.t b/t/ticket/requestor-order.t
index d8308d3..4a729ba 100644
--- a/t/ticket/requestor-order.t
+++ b/t/ticket/requestor-order.t
@@ -16,7 +16,7 @@ my @requestors = ( ('bravo at example.com') x 6, ('alpha at example.com') x 6,
 my @subjects = ("first test", "second test", "third test", "fourth test", "fifth test") x 6;
 while (@requestors) {
     my $t = RT::Ticket->new(RT->SystemUser);
-    my ( $id, undef $msg ) = $t->Create(
+    my ( $id, undef, $msg ) = $t->Create(
         Queue      => $q->id,
         Subject    => shift @subjects,
         Requestor => [ shift @requestors ]
diff --git a/t/ticket/search.t b/t/ticket/search.t
index dad94a1..2845dd8 100644
--- a/t/ticket/search.t
+++ b/t/ticket/search.t
@@ -58,7 +58,7 @@ ok($dupcf->id, "Created the SearchTest3 CF");
 
 
 my $t1 = RT::Ticket->new(RT->SystemUser);
-my ( $id, undef $msg ) = $t1->Create(
+my ( $id, undef, $msg ) = $t1->Create(
     Queue      => $q->id,
     Subject    => 'SearchTest1',
     Requestor  => ['search1 at example.com'],
diff --git a/t/ticket/search_long_cf_values.t b/t/ticket/search_long_cf_values.t
index 5b904b3..74b554a 100644
--- a/t/ticket/search_long_cf_values.t
+++ b/t/ticket/search_long_cf_values.t
@@ -23,7 +23,7 @@ my $cflabel = "CustomField-".$cf->id;
 
 # setup some tickets
 my $t1 = RT::Ticket->new(RT->SystemUser);
-my ( $id, undef $msg ) = $t1->Create(
+my ( $id, undef, $msg ) = $t1->Create(
     Queue      => $q->id,
     Subject    => 'SearchTest1',
     Requestor  => ['search at example.com'],

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


More information about the rt-commit mailing list