testing dbicadmin/DBIx::Class::Admin integration
[dbsrgits/DBIx-Class.git] / t / admin / 10script.t
index a53ecf1..633d797 100644 (file)
@@ -10,23 +10,13 @@ use DBICTest;
 
 
 BEGIN {
-    eval "require DBIx::Class::Admin";
-    plan skip_all => "Deps not installed: $@" if $@;
-
-    eval "require Getopt::Long::Descriptive";
-    plan skip_all => 'Install Getopt::Long::Descriptive to run this test' if ($@);
-
-    eval 'require JSON::Any';
-    plan skip_all => 'Install JSON::Any to run this test' if ($@);
-
-    eval 'require Text::CSV_XS';
-    if ($@) {
-        eval 'require Text::CSV_PP';
-        plan skip_all => 'Install Text::CSV_XS or Text::CSV_PP to run this test' if ($@);
-    }
+    require DBIx::Class;
+    plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for('admin_script')
+      unless DBIx::Class::Optional::Dependencies->req_ok_for('admin_script');
 }
+
 my @json_backends = qw/XS JSON DWIW/;
-my $tests_per_run = 5;
+my $tests_per_run = 6;
 
 plan tests => $tests_per_run * @json_backends;
 
@@ -39,12 +29,15 @@ for my $js (@json_backends) {
         $ENV{JSON_ANY_ORDER} = $js;
         eval { test_dbicadmin () };
         diag $@ if $@;
+
+        # test the script is setting @INC properly
+        like(`script/dbicadmin -It/dbicadmin-test-include/lib --schema=Foo --op=deploy --connect=[] --debug`,
+           qr|Adding to \@INC:\nt/dbicadmin-test-include/lib|
+        );
     }
 }
 
 sub test_dbicadmin {
-#    $ENV{PERL5LIB} = join ':', @INC;
-
     my $schema = DBICTest->init_schema( sqlite_use_file => 1 );  # reinit a fresh db for every run
 
     my $employees = $schema->resultset('Employee');