Fix failures and protect the suite from spurious VERSION-related warnings
[dbsrgits/DBIx-Class.git] / t / admin / 10script.t
index 9f4ab90..d8acf4a 100644 (file)
@@ -2,6 +2,12 @@
 use strict;
 use warnings;
 
+BEGIN {
+  # just in case the user env has stuff in it
+  delete $ENV{JSON_ANY_ORDER};
+  delete $ENV{DBICTEST_VERSION_WARNS_INDISCRIMINATELY};
+}
+
 use Test::More;
 use Config;
 use File::Spec;
@@ -18,12 +24,11 @@ BEGIN {
   delete $ENV{JSON_ANY_ORDER};
 }
 
-use JSON::Any;
-
 $ENV{PATH} = '';
 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
 
-my @json_backends = qw/XS JSON DWIW/;
+require JSON::Any;
+my @json_backends = qw(DWIW PP JSON CPANEL XS);
 
 # test the script is setting @INC properly
 test_exec (qw|-It/lib/testinclude --schema=DBICTestAdminInc --connect=[] --insert|);
@@ -42,9 +47,9 @@ cmp_ok ($? >> 8, '==', 71, 'Correct schema loaded via testconfig');
 
 for my $js (@json_backends) {
 
-    eval {JSON::Any->import ($js) };
     SKIP: {
-        skip ("JSON backend $js is not available, skip testing", 1) if $@;
+        eval {JSON::Any->import ($js); 1 }
+          or skip ("JSON backend $js is not available, skip testing", 1);
 
         local $ENV{JSON_ANY_ORDER} = $js;
         eval { test_dbicadmin () };