[Bps-public-commit] RT-Extension-MergeUsers branch, master, updated. 1.02_01-2-g70bdbbe

Shawn Moore shawn at bestpractical.com
Tue Nov 22 17:32:22 EST 2016


The branch, master has been updated
       via  70bdbbee70579be779dfdd1be528ccfd8286e2e7 (commit)
      from  617cd5c3b5dd0b35e85442829883842d344a835b (commit)

Summary of changes:
 .gitignore                             |  1 +
 MANIFEST                               |  2 ++
 Makefile.PL                            |  1 +
 lib/RT/Extension/MergeUsers/Test.pm.in | 40 ++++++++++++++++++++++++++++++++++
 xt/01merge_users.t                     |  7 +++---
 xt/change_email.t                      |  4 +---
 xt/collection.t                        |  7 +++---
 7 files changed, 52 insertions(+), 10 deletions(-)
 create mode 100644 lib/RT/Extension/MergeUsers/Test.pm.in

- Log -----------------------------------------------------------------
commit 70bdbbee70579be779dfdd1be528ccfd8286e2e7
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Tue Nov 22 22:29:55 2016 +0000

    Fix tests not being able to load RT::Test
    
    Fleshing out the testing infrastructure was necessary to get /opt/rt4
    (or wherever the user has installed RT into) into @INC

diff --git a/.gitignore b/.gitignore
index faa588c..e27c895 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ pm_to_blib
 /bin/rt-update-merged-users
 /bin/rt-clean-merged-users
 /xt/tmp
+/lib/RT/Extension/MergeUsers/Test.pm
diff --git a/MANIFEST b/MANIFEST
index 44fabbc..4859a9e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -22,6 +22,8 @@ inc/Module/Install/WriteAll.pm
 inc/unicore/Name.pm
 inc/YAML/Tiny.pm
 lib/RT/Extension/MergeUsers.pm
+lib/RT/Extension/MergeUsers/Test.pm
+lib/RT/Extension/MergeUsers/Test.pm.in
 Makefile.PL
 MANIFEST			This list of files
 MANIFEST.SKIP
diff --git a/Makefile.PL b/Makefile.PL
index bdd4465..7e9deb4 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -23,6 +23,7 @@ substitute( {
     'bin/rt-update-merged-users',
     'bin/rt-merge-users',
     'bin/rt-clean-merged-users',
+    'lib/RT/Extension/MergeUsers/Test.pm',
 );
 
 no_index( package => 'RT::User', 'RT::Users', 'RT::Principal');
diff --git a/lib/RT/Extension/MergeUsers/Test.pm.in b/lib/RT/Extension/MergeUsers/Test.pm.in
new file mode 100644
index 0000000..1f9bb4b
--- /dev/null
+++ b/lib/RT/Extension/MergeUsers/Test.pm.in
@@ -0,0 +1,40 @@
+use strict;
+use warnings;
+
+### after: use lib qw(@RT_LIB_PATH@);
+use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+
+package RT::Extension::MergeUsers::Test;
+
+our @ISA;
+BEGIN {
+    local $@;
+    eval { require RT::Test; 1 } or do {
+        require Test::More;
+        Test::More::BAIL_OUT(
+            "requires 3.8 to run tests. Error:\n$@\n"
+            ."You may need to set PERL5LIB=/path/to/rt/lib"
+        );
+    };
+    push @ISA, 'RT::Test';
+}
+
+sub import {
+    my $class = shift;
+    my %args  = @_;
+
+    $args{'requires'} ||= [];
+    if ( $args{'testing'} ) {
+        unshift @{ $args{'requires'} }, 'RT::Extension::MergeUsers';
+    } else {
+        $args{'testing'} = 'RT::Extension::MergeUsers';
+    }
+
+    $class->SUPER::import( %args );
+    $class->export_to_level(1);
+
+    require RT::Extension::MergeUsers;
+}
+
+1;
+
diff --git a/xt/01merge_users.t b/xt/01merge_users.t
index 32314cd..f7cd535 100644
--- a/xt/01merge_users.t
+++ b/xt/01merge_users.t
@@ -1,9 +1,8 @@
-#!/sw/bin/perl5.8.6
+#!/usr/bin/perl
 
 use strict;
-use RT::Test
-    tests   => 'no_declare',
-    testing => 'RT::Extension::MergeUsers';
+use warnings;
+use RT::Extension::MergeUsers::Test tests => undef;
 
 my ($id, $message);
 
diff --git a/xt/change_email.t b/xt/change_email.t
index 0066e72..3128537 100644
--- a/xt/change_email.t
+++ b/xt/change_email.t
@@ -2,9 +2,7 @@
 
 use strict;
 use warnings;
-use RT::Test
-    tests   => 'no_declare',
-    testing => 'RT::Extension::MergeUsers';
+use RT::Extension::MergeUsers::Test tests => undef;
 
 my ($id, $message);
 
diff --git a/xt/collection.t b/xt/collection.t
index 35e268c..3403fb4 100644
--- a/xt/collection.t
+++ b/xt/collection.t
@@ -1,7 +1,8 @@
+#!/usr/bin/perl
+
 use strict;
-use RT::Test
-    tests   => 'no_declare',
-    testing => 'RT::Extension::MergeUsers';
+use warnings;
+use RT::Extension::MergeUsers::Test tests => undef;
 
 my ($id, $message);
 

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


More information about the Bps-public-commit mailing list