X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fadmin%2F10script.t;h=ce3d27e7743546ac57833cb5d12f7dee3fc8e547;hb=af1f4f842ae446a3339b92b33851ea80c928f17a;hp=04d327cf6906e6046f09df99e7d304fbed88802c;hpb=099f10d17d95b08b12a9c88129c65b4bab0b60e2;p=dbsrgits%2FDBIx-Class.git diff --git a/t/admin/10script.t b/t/admin/10script.t index 04d327c..ce3d27e 100644 --- a/t/admin/10script.t +++ b/t/admin/10script.t @@ -16,19 +16,27 @@ BEGIN { } my @json_backends = qw/XS JSON DWIW/; -my $tests_per_run = 5; -plan tests => ($tests_per_run * @json_backends) + 1; - # test the script is setting @INC properly -test_exec (qw| -It/lib/testinclude --schema=DBICTestAdminInc --op=deploy --connect=[] |); -cmp_ok ( $? >> 8, '==', 70, 'Correct exit code from deploying a custom INC schema' ); +test_exec (qw|-It/lib/testinclude --schema=DBICTestAdminInc --connect=[] --insert|); +cmp_ok ( $? >> 8, '==', 70, 'Correct exit code from connecting a custom INC schema' ); + +# test that config works properly +{ + no warnings 'qw'; + test_exec(qw|-It/lib/testinclude --schema=DBICTestConfig --create --connect=["klaatu","barada","nikto"]|); + cmp_ok( $? >> 8, '==', 71, 'Correct schema loaded via config' ) || exit; +} + +# test that config-file works properly +test_exec(qw|-It/lib/testinclude --schema=DBICTestConfig --config=t/lib/admincfgtest.json --config-stanza=Model::Gort --deploy|); +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", $tests_per_run) if $@; + skip ("JSON backend $js is not available, skip testing", 1) if $@; $ENV{JSON_ANY_ORDER} = $js; eval { test_dbicadmin () }; @@ -36,6 +44,8 @@ for my $js (@json_backends) { } } +done_testing(); + sub test_dbicadmin { my $schema = DBICTest->init_schema( sqlite_use_file => 1 ); # reinit a fresh db for every run @@ -56,7 +66,7 @@ sub test_dbicadmin { SKIP: { skip ("MSWin32 doesn't support -| either", 1) if $^O eq 'MSWin32'; - open(my $fh, "-|", ( 'script/dbicadmin', default_args(), qw|--op=select --attrs={"order_by":"name"}| ) ) or die $!; + open(my $fh, "-|", ( $^X, 'script/dbicadmin', default_args(), qw|--op=select --attrs={"order_by":"name"}| ) ) or die $!; my $data = do { local $/; <$fh> }; close($fh); if (!ok( ($data=~/Aran.*Trout/s), "$ENV{JSON_ANY_ORDER}: select with attrs" )) {