From: Gordon Irving Date: Tue, 15 Dec 2009 22:16:00 +0000 (+0000) Subject: update test suite to skip if cannot load DBIx::Class::Admin X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6bceaca3027dcc297955cf373f5ea62b8634afc3;p=dbsrgits%2FDBIx-Class-Historic.git update test suite to skip if cannot load DBIx::Class::Admin --- diff --git a/t/admin/01load.t b/t/admin/01load.t index dd3a8ec..d91eeed 100644 --- a/t/admin/01load.t +++ b/t/admin/01load.t @@ -8,8 +8,7 @@ # FILES: --- # BUGS: --- # NOTES: --- -# AUTHOR: Gordon Irving (), -# COMPANY: Sophos +# AUTHOR: Gordon Irving (), # VERSION: 1.0 # CREATED: 28/11/09 13:54:30 GMT # REVISION: --- @@ -20,12 +19,21 @@ use warnings; use Test::More; # last test to print -use Path::Class; use FindBin qw($Bin); +use Path::Class; + + use lib dir($Bin,'..', '..','lib')->stringify; use lib dir($Bin,'..', 'lib')->stringify; -use ok 'DBIx::Class::Admin'; + + +BEGIN { + eval "use DBIx::Class::Admin"; + plan skip_all => "Deps not installed: $@" if $@; +} + +use_ok 'DBIx::Class::Admin'; done_testing; diff --git a/t/admin/02ddl.t b/t/admin/02ddl.t index 8ad1399..3aaf60c 100644 --- a/t/admin/02ddl.t +++ b/t/admin/02ddl.t @@ -8,8 +8,7 @@ # FILES: --- # BUGS: --- # NOTES: --- -# AUTHOR: Gordon Irving (), -# COMPANY: Sophos +# AUTHOR: Gordon Irving (), # VERSION: 1.0 # CREATED: 28/11/09 16:14:21 GMT # REVISION: --- @@ -22,9 +21,14 @@ use Test::More; # last test to print use Test::Exception; + +BEGIN { + eval "use DBIx::Class::Admin"; + plan skip_all => "Deps not installed: $@" if $@; +} + use Path::Class; use FindBin qw($Bin); - use Module::Load; use lib dir($Bin,'..', '..','lib')->stringify; diff --git a/t/admin/03data.t b/t/admin/03data.t index e328c14..96c4ff8 100644 --- a/t/admin/03data.t +++ b/t/admin/03data.t @@ -8,7 +8,7 @@ # FILES: --- # BUGS: --- # NOTES: --- -# AUTHOR: Gordon Irving (), +# AUTHOR: Gordon Irving (), # VERSION: 1.0 # CREATED: 12/12/09 12:44:57 GMT # REVISION: --- @@ -22,6 +22,11 @@ use Test::More; use Test::Exception; use Test::Deep; +BEGIN { + eval "use DBIx::Class::Admin"; + plan skip_all => "Deps not installed: $@" if $@; +} + use Path::Class; use FindBin qw($Bin); @@ -50,19 +55,19 @@ use DBICTest; ); isa_ok ($admin, 'DBIx::Class::Admin', 'create the admin object'); - $admin->insert_data('Employee', { name => 'Matt' }); + $admin->insert('Employee', { name => 'Matt' }); my $employees = $schema->resultset('Employee'); is ($employees->count(), 1, "insert okay" ); my $employee = $employees->find(1); is($employee->name(), 'Matt', "insert valid" ); - $admin->update_data('Employee', {name => 'Trout'}, {name => 'Matt'}); + $admin->update('Employee', {name => 'Trout'}, {name => 'Matt'}); $employee = $employees->find(1); is($employee->name(), 'Trout', "update Matt to Trout" ); - $admin->insert_data('Employee', {name =>'Aran'}); + $admin->insert('Employee', {name =>'Aran'}); my $expected_data = [ [$employee->result_source->columns() ], @@ -70,10 +75,10 @@ use DBICTest; [2,2,undef,undef,undef,'Aran'] ]; my $data; - lives_ok { $data = $admin->select_data('Employee')} 'can retrive data from database'; + lives_ok { $data = $admin->select('Employee')} 'can retrive data from database'; cmp_deeply($data, $expected_data, 'DB matches whats expected'); - $admin->delete_data('Employee', {name=>'Trout'}); + $admin->delete('Employee', {name=>'Trout'}); my $del_rs = $employees->search({name => 'Trout'}); is($del_rs->count(), 0, "delete Trout" ); is ($employees->count(), 1, "left Aran" );