Merge 'trunk' into 'storage-interbase'
Rafael Kitover [Mon, 22 Feb 2010 11:15:16 +0000 (11:15 +0000)]
r23356@hlagh (orig r8756):  caelum | 2010-02-19 06:21:53 -0500
bump Test::Pod dep
r23357@hlagh (orig r8757):  caelum | 2010-02-19 06:23:07 -0500
bump Test::Pod dep in Optional::Dependencies too
r23380@hlagh (orig r8760):  ribasushi | 2010-02-19 10:40:18 -0500
Fix stupid sqlt parser regression
r23381@hlagh (orig r8761):  ribasushi | 2010-02-19 10:41:36 -0500
Port remaining tests to the Opt::Dep reposiory
r23382@hlagh (orig r8762):  ribasushi | 2010-02-19 10:42:32 -0500
Some test cleanups
r23387@hlagh (orig r8767):  ribasushi | 2010-02-20 14:57:59 -0500
Test::Deep actually isn't required
r23393@hlagh (orig r8773):  ribasushi | 2010-02-20 16:20:22 -0500
These are core for perl 5.8
r23394@hlagh (orig r8774):  ribasushi | 2010-02-21 04:51:13 -0500
Shuffle tests a bit
r23395@hlagh (orig r8775):  ribasushi | 2010-02-21 06:07:58 -0500
Bogus require
r23396@hlagh (orig r8776):  ribasushi | 2010-02-21 06:08:21 -0500
Bogus unnecessary dep
r23407@hlagh (orig r8787):  ribasushi | 2010-02-21 07:37:53 -0500
 r8748@Thesaurus (orig r8735):  goraxe | 2010-02-17 23:17:15 +0100
 branch for dbicadmin pod fixes

 r8778@Thesaurus (orig r8765):  goraxe | 2010-02-20 20:35:00 +0100
 add G:L:D sub classes to generate pod
 r8779@Thesaurus (orig r8766):  goraxe | 2010-02-20 20:56:16 +0100
 dbicadmin: use subclassed G:L:D to generate some pod
 r8782@Thesaurus (orig r8769):  goraxe | 2010-02-20 21:48:29 +0100
 adjust Makefile.pl to generate dbicadmin.pod
 r8783@Thesaurus (orig r8770):  goraxe | 2010-02-20 21:50:55 +0100
 add svn-ignore for dbicadmin.pod
 r8784@Thesaurus (orig r8771):  goraxe | 2010-02-20 22:01:41 +0100
 change Options to Arguments
 r8785@Thesaurus (orig r8772):  goraxe | 2010-02-20 22:10:29 +0100
 add DBIx::Class::Admin::{Descriptive,Usage} to podcover ignore list
 r8790@Thesaurus (orig r8777):  rabbit | 2010-02-21 12:35:38 +0100
 Cleanup the makefile regen a bit
 r8792@Thesaurus (orig r8779):  rabbit | 2010-02-21 12:53:01 +0100
 Bah humbug
 r8793@Thesaurus (orig r8780):  rabbit | 2010-02-21 12:55:18 +0100
 And another one
 r8797@Thesaurus (orig r8784):  rabbit | 2010-02-21 13:32:03 +0100
 The minimal pod seems to confuse the manpage generator, commenting out for now
 r8798@Thesaurus (orig r8785):  rabbit | 2010-02-21 13:38:03 +0100
 Add license/author to dbicadmin autogen POD
 r8799@Thesaurus (orig r8786):  rabbit | 2010-02-21 13:38:58 +0100
 Reorder makefile author actions to make output more readable

r23410@hlagh (orig r8790):  ribasushi | 2010-02-21 08:24:15 -0500
Fix exception text
r23411@hlagh (orig r8791):  ribasushi | 2010-02-21 09:14:58 -0500
Extra testdep

22 files changed:
.gitignore
Changes
Makefile.PL
lib/DBIx/Class/Admin/Descriptive.pm [new file with mode: 0644]
lib/DBIx/Class/Admin/Usage.pm [new file with mode: 0644]
lib/DBIx/Class/Optional/Dependencies.pm
lib/DBIx/Class/Relationship/Accessor.pm
lib/SQL/Translator/Parser/DBIx/Class.pm
script/dbicadmin
t/02pod.t
t/03podcoverage.t
t/52cycle.t
t/69update.t
t/75limit.t
t/76joins.t
t/99dbic_sqlt_parser.t
t/admin/02ddl.t
t/admin/03data.t
t/bind/attribute.t
t/sqlahacks/quotes/quotes.t
t/sqlahacks/quotes/quotes_newstyle.t
t/storage/error.t

index 5aa3840..ea0a947 100644 (file)
@@ -10,5 +10,6 @@ _build/
 blib/
 inc/
 lib/DBIx/Class/Optional/Dependencies.pod
+lib/dbicadmin.pod
 pm_to_blib
 t/var/
diff --git a/Changes b/Changes
index 6be2659..6907498 100644 (file)
--- a/Changes
+++ b/Changes
@@ -5,6 +5,9 @@ Revision history for DBIx::Class
         - Fix count() with group_by aliased-function resultsets
         - Massive refactor and cleanup of primary key handling
         - Fixed regression losing custom result_class (really this time)
+          (RT#54697)
+        - Fixed regression in DBIC SQLT::Parser failing with a classname
+          (as opposed to a schema object)
 
 0.08119 2010-02-15 09:36:00 (UTC)
         - Add $rs->is_ordered to test for existing order_by on a resultset
index e747063..d98c782 100644 (file)
@@ -8,6 +8,11 @@ use 5.008001;
 use FindBin;
 use lib "$FindBin::Bin/lib";
 
+# adjust ENV for $AUTHOR system() calls
+use Config;
+$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
+
+
 ###
 ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
 ### All of them should go to DBIx::Class::Optional::Dependencies
@@ -25,19 +30,12 @@ my $build_requires = {
 my $test_requires = {
   'File::Temp'               => '0.22',
   'Test::Builder'            => '0.33',
-  'Test::Deep'               => '0',
   'Test::Exception'          => '0',
   'Test::More'               => '0.92',
   'Test::Warn'               => '0.21',
 };
 
 my $runtime_requires = {
-  # Core
-  'List::Util'               => '0',
-  'Scalar::Util'             => '0',
-  'Storable'                 => '0',
-
-  # Dependencies
   'Carp::Clan'               => '6.0',
   'Class::Accessor::Grouped' => '0.09002',
   'Class::C3::Componentised' => '1.0005',
@@ -47,7 +45,6 @@ my $runtime_requires = {
   'MRO::Compat'              => '0.09',
   'Module::Find'             => '0.06',
   'Path::Class'              => '0.18',
-  'Scope::Guard'             => '0.03',
   'SQL::Abstract'            => '1.61',
   'SQL::Abstract::Limit'     => '0.13',
   'Sub::Name'                => '0.04',
@@ -62,25 +59,9 @@ my $reqs = {
   test_requires => { %$test_requires },
 };
 
-# re-build README and require extra modules for testing if we're in a checkout
-if ($Module::Install::AUTHOR) {
-
-  print "Regenerating README\n";
-  system('pod2text lib/DBIx/Class.pm > README');
-
-  if (-f 'MANIFEST') {
-    print "Removing MANIFEST\n";
-    unlink 'MANIFEST';
-  }
-
-  print "Regenerating Optional/Dependencies.pod\n";
-  require DBIx::Class::Optional::Dependencies;
-  DBIx::Class::Optional::Dependencies->_gen_pod;
-
-# FIXME Disabled due to unsolved issues, ask theorbtwo
-#  require Module::Install::Pod::Inherit;
-#  PodInherit();
 
+# require extra modules for testing if we're in a checkout
+if ($Module::Install::AUTHOR) {
   warn <<'EOW';
 ******************************************************************************
 ******************************************************************************
@@ -92,6 +73,7 @@ if ($Module::Install::AUTHOR) {
 
 EOW
 
+  require DBIx::Class::Optional::Dependencies;
   $reqs->{test_requires} = {
     %{$reqs->{test_requires}},
     %{DBIx::Class::Optional::Dependencies->_all_optional_requirements},
@@ -119,6 +101,31 @@ for my $mod (sort keys %final_req) {
   $rtype->($mod, $ver);
 }
 
+auto_install();
+
+# re-create various autogenerated documentation bits
+if ($Module::Install::AUTHOR) {
+
+  print "Regenerating README\n";
+  system('pod2text lib/DBIx/Class.pm > README');
+
+  if (-f 'MANIFEST') {
+    print "Removing MANIFEST\n";
+    unlink 'MANIFEST';
+  }
+
+  print "Regenerating dbicadmin.pod\n";
+  system('perl script/dbicadmin --pod > lib/dbicadmin.pod');
+
+  print "Regenerating Optional/Dependencies.pod\n";
+  require DBIx::Class::Optional::Dependencies;
+  DBIx::Class::Optional::Dependencies->_gen_pod;
+
+  # FIXME Disabled due to unsolved issues, ask theorbtwo
+  #  require Module::Install::Pod::Inherit;
+  #  PodInherit();
+}
+
 install_script (qw|
     script/dbicadmin
 |);
@@ -142,8 +149,6 @@ no_index package => $_ for (qw/
 /);
 
 
-auto_install();
-
 WriteAll();
 
 
diff --git a/lib/DBIx/Class/Admin/Descriptive.pm b/lib/DBIx/Class/Admin/Descriptive.pm
new file mode 100644 (file)
index 0000000..45fcb19
--- /dev/null
@@ -0,0 +1,10 @@
+package     # hide from PAUSE
+    DBIx::Class::Admin::Descriptive;
+
+use DBIx::Class::Admin::Usage;
+
+use base 'Getopt::Long::Descriptive';
+
+sub usage_class { 'DBIx::Class::Admin::Usage'; }
+
+1;
diff --git a/lib/DBIx/Class/Admin/Usage.pm b/lib/DBIx/Class/Admin/Usage.pm
new file mode 100644 (file)
index 0000000..9cae79b
--- /dev/null
@@ -0,0 +1,85 @@
+package     # hide from PAUSE
+    DBIx::Class::Admin::Usage;
+
+
+use base 'Getopt::Long::Descriptive::Usage';
+
+use base 'Class::Accessor::Grouped';
+
+use Class::C3;
+
+__PACKAGE__->mk_group_accessors('simple', 'synopsis', 'short_description');
+
+sub prog_name {
+    Getopt::Long::Descriptive::prog_name();
+}
+
+sub set_simple {
+    my ($self,$field, $value) = @_;
+    my $prog_name = prog_name();
+    $value =~ s/%c/$prog_name/g;
+    $self->next::method($field, $value);
+}
+
+
+=head2 pod
+
+This returns the usage formated as a pod document
+
+=cut
+
+
+sub pod {
+  my ($self) = @_;
+  return join qq{\n}, $self->pod_leader_text, $self->pod_option_text, $self->pod_authorlic_text;
+}
+
+sub pod_leader_text {
+  my ($self) = @_;
+
+  return qq{=head1 NAME\n\n}.prog_name()." - ".$self->short_description().qq{\n\n}.
+         qq{=head1 SYNOPSIS\n\n}.$self->leader_text().qq{\n}.$self->synopsis().qq{\n\n};
+
+}
+
+sub pod_authorlic_text {
+
+  return <<'EOA'
+=head1 AUTHORS
+
+See L<DBIx::Class/CONTRIBUTORS>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself
+EOA
+}
+
+
+sub pod_option_text {
+  my ($self) = @_;
+  my @options = @{ $self->{options} || [] };
+  my $string = q{};
+  return $string unless @options;
+
+  $string .= "=head1 OPTIONS\n\n=over\n\n";
+
+  foreach my $opt (@options) {
+    my $spec = $opt->{spec};
+    my $desc = $opt->{desc};
+    if ($desc eq 'spacer') {
+        $string .= "=back\n\n=head2 $spec\n\n=cut\n\n=over\n\n";
+        next;
+    }
+
+    $spec = Getopt::Long::Descriptive->_strip_assignment($spec);
+    $string .= "=item " . join " or ", map { length > 1 ? "B<--$_>" : "B<-$_>" }
+                             split /\|/, $spec; 
+    $string .= "\n\n$desc\n\n=cut\n\n";
+
+  }
+  $string .= "=back\n\n";
+  return $string;
+}
+
+1;
index c1a4fe4..182ae60 100644 (file)
@@ -74,28 +74,55 @@ my $reqs = {
     },
   },
 
-  author => {
+
+  test_pod => {
+    req => {
+      'Test::Pod'                 => '1.41',
+    },
+  },
+
+  test_podcoverage => {
     req => {
-      'Test::Pod'                 => '1.26',
       'Test::Pod::Coverage'       => '1.08',
       'Pod::Coverage'             => '0.20',
+    },
+  },
+
+  test_notabs => {
+    req => {
       #'Test::NoTabs'              => '0.9',
+    },
+  },
+
+  test_eol => {
+    req => {
       #'Test::EOL'                 => '0.6',
     },
   },
 
-  core => {
+  test_cycle => {
     req => {
-      # t/52cycle.t
       'Test::Memory::Cycle'       => '0',
       'Devel::Cycle'              => '1.10',
+    },
+  },
 
+  test_dtrelated => {
+    req => {
       # t/36datetime.t
       # t/60core.t
       'DateTime::Format::SQLite'  => '0',
 
       # t/96_is_deteministic_value.t
       'DateTime::Format::Strptime'=> '0',
+
+      # t/inflate/datetime_mysql.t
+      # (doesn't need Mysql itself)
+      'DateTime::Format::MySQL' => '0',
+
+      # t/inflate/datetime_pg.t
+      # (doesn't need PG itself)
+      'DateTime::Format::Pg'  => '0',
     },
   },
 
@@ -116,7 +143,6 @@ my $reqs = {
         ? (
           'Sys::SigAction'        => '0',
           'DBD::Pg'               => '2.009002',
-          'DateTime::Format::Pg'  => '0',
         ) : ()
     },
   },
@@ -125,7 +151,6 @@ my $reqs = {
     req => {
       $ENV{DBICTEST_MYSQL_DSN}
         ? (
-          'DateTime::Format::MySQL' => '0',
           'DBD::mysql'              => '0',
         ) : ()
     },
@@ -157,6 +182,16 @@ my $reqs = {
         ) : ()
     },
   },
+
+  rdbms_db2 => {
+    req => {
+      $ENV{DBICTEST_DB2_DSN}
+        ? (
+          'DBD::DB2' => 0,
+        ) : ()
+    },
+  },
+
 };
 
 
index eb03a3d..03700f4 100644 (file)
@@ -4,7 +4,6 @@ package # hide from PAUSE
 use strict;
 use warnings;
 use Sub::Name ();
-use Class::Inspector ();
 
 our %_pod_inherit_config = 
   (
index 2efc5b1..32fe04f 100644 (file)
@@ -33,7 +33,7 @@ use base qw(Exporter);
 sub parse {
     # this is a hack to prevent schema leaks due to a retarded SQLT implementation
     # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway)
-    Scalar::Util::weaken ($_[1]);
+    Scalar::Util::weaken ($_[1]) if ref ($_[1]);
 
     my ($tr, $data)   = @_;
     my $args          = $tr->parser_args;
index 2b6a456..59c48c6 100755 (executable)
@@ -5,31 +5,48 @@ use warnings;
 
 BEGIN {
   use DBIx::Class;
-  die (  "The following modules are required for the dbicadmin utility\n"
+  die (  'The following modules are required for the dbicadmin utility: '
        . DBIx::Class::Optional::Dependencies->req_missing_for ('admin_script')
+       . "\n"
   ) unless DBIx::Class::Optional::Dependencies->req_ok_for ('admin_script');
 }
 
-use Getopt::Long::Descriptive;
+use DBIx::Class::Admin::Descriptive;
+#use Getopt::Long::Descriptive;
 use DBIx::Class::Admin;
 
+my $short_description = "utility for administrating DBIx::Class schemata";
+my $synopsis_text =qq{ 
+  deploy a schema to a database
+  %c --schema=MyApp::Schema \
+    --connect='["dbi:SQLite:my.db", "", ""]' \
+    --deploy
+
+  update an existing record
+  %c --schema=MyApp::Schema --class=Employee \
+    --connect='["dbi:SQLite:my.db", "", ""]' \
+    --op=update --set='{ "name": "New_Employee" }'
+}
+;
+
 my ($opts, $usage) = describe_options(
-  "%c: %o",
+    "%c: %o",
   (
     ['Actions'],
     ["action" => hidden => { one_of => [
       ['create|c' => 'Create version diffs needs preversion',],
-      ['upgrade|u' => 'Upgrade the database to the current schema '],
-      ['install|i' => 'Install the schema to the database',],
+      ['upgrade|U' => 'Upgrade the database to the current schema '],
+      ['install|I' => 'Install the schema version tables to an existing database',],
       ['deploy|d' => 'Deploy the schema to the database',],
       ['select|s'   => 'Select data from the schema', ],
       ['insert|i'   => 'Insert data into the schema', ],
       ['update|u'   => 'Update data in the schema', ], 
       ['delete|D'   => 'Delete data from the schema',],
       ['op:s' => 'compatiblity option all of the above can be suppied as --op=<action>'],
-      ['help|h' => 'display this help'],
+      ['help|h' => 'display this help', { implies => { schema_class => 'main' } } ],
+      ['pod' => 'Output this usage as pod', { implies => { schema_class => 'main' } } ],
     ], required=> 1 }],
-    ['Options'],
+    ['Arguments'],
     ['schema-class|schema|C:s' => 'The class of the schema to load', { required => 1 } ],
     ['resultset|resultset_class|class|r:s' => 'The resultset to operate on for data manipulation' ],
     ['config-stanza|S:s' => 'Where in the config to find the connection_info, supply in form MyApp::Model::DB',],
@@ -41,7 +58,6 @@ my ($opts, $usage) = describe_options(
     ['version|v:i' => 'Supply a version install'],
     ['preversion|p:s' => 'The previous version to diff against',],
     ['set:s' => 'JSON data used to perform data operations' ],
-    ['lib|I:s' => 'Additonal library path to search in'], 
     ['attrs:s' => 'JSON string to be used for the second argument for search'],
     ['where:s' => 'JSON string to be used for the where clause of search'],
     ['force' => 'Be forceful with some operations'],
@@ -52,6 +68,17 @@ my ($opts, $usage) = describe_options(
 
 die "please only use one of --config or --connect-info\n" if ($opts->{config} and $opts->{connect_info});
 
+if($opts->{pod}) {
+    $usage->synopsis($synopsis_text);
+    $usage->short_description($short_description);
+    print $usage->pod();
+    exit 0;
+}
+
+if($opts->{help}) {
+    $usage->die();
+}
+
 # option compatability mangle
 if($opts->{connect}) {
   $opts->{connect_info} = delete $opts->{connect};
@@ -84,12 +111,29 @@ if ($action eq 'select') {
   }
 }
 
-=head1 AUTHOR
-
-See L<DBIx::Class/CONTRIBUTORS>.
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself
 
-=cut
+#__END__
+#
+#=begin pod_begin
+#
+#BEGIN MARKER FOR DYNAMIC POD
+#
+#=end pod_begin
+#
+#=begin pod_end
+#
+#END MARKER FOR DYNAMIC POD
+#
+#=end pod_end
+#
+#=head1 AUTHOR
+#
+#See L<DBIx::Class/CONTRIBUTORS>.
+#
+#=head1 LICENSE
+#
+#You may distribute this code under the same terms as Perl itself
+#
+#=cut
+
+# vim: et ft=perl
index 729aa09..1c55c96 100644 (file)
--- a/t/02pod.t
+++ b/t/02pod.t
@@ -5,23 +5,17 @@ use Test::More;
 use lib qw(t/lib);
 use DBICTest;
 
-my @MODULES = (
-  'Test::Pod 1.26',
-);
-
 # Don't run tests for installs
 unless ( DBICTest::AuthorCheck->is_author || $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING} ) {
   plan( skip_all => "Author tests not required for installation" );
 }
 
-# Load the testing modules
-foreach my $MODULE ( @MODULES ) {
-  eval "use $MODULE";
-  if ( $@ ) {
-    $ENV{RELEASE_TESTING}
-    ? die( "Failed to load required release-testing module $MODULE" )
-    : plan( skip_all => "$MODULE not available for testing" );
-  }
+require DBIx::Class;
+unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_pod') ) {
+  my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_pod');
+  $ENV{RELEASE_TESTING} || DBICTest::AuthorCheck->is_author
+    ? die ("Failed to load release-testing module requirements: $missing")
+    : plan skip_all => "Test needs: $missing"
 }
 
-all_pod_files_ok();
+Test::Pod::all_pod_files_ok();
index 88af1c4..3115234 100644 (file)
@@ -6,24 +6,17 @@ use List::Util ();
 use lib qw(t/lib);
 use DBICTest;
 
-my @MODULES = (
-  'Test::Pod::Coverage 1.08',
-  'Pod::Coverage 0.20',
-);
-
 # Don't run tests for installs
 unless ( DBICTest::AuthorCheck->is_author || $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING} ) {
   plan( skip_all => "Author tests not required for installation" );
 }
 
-# Load the testing modules
-foreach my $MODULE ( @MODULES ) {
-  eval "use $MODULE";
-  if ( $@ ) {
-    $ENV{RELEASE_TESTING}
-    ? die( "Failed to load required release-testing module $MODULE" )
-    : plan( skip_all => "$MODULE not available for testing" );
-  }
+require DBIx::Class;
+unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_podcoverage') ) {
+  my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_podcoverage');
+  $ENV{RELEASE_TESTING} || DBICTest::AuthorCheck->is_author
+    ? die ("Failed to load release-testing module requirements: $missing")
+    : plan skip_all => "Test needs: $missing"
 }
 
 # Since this is about checking documentation, a little documentation
@@ -93,7 +86,7 @@ my $exceptions = {
         /]
     },
 
-    'DBIx::Class::Admin::Types'                     => { skip => 1 },
+    'DBIx::Class::Admin::*'                         => { skip => 1 },
     'DBIx::Class::ClassResolver::PassThrough'       => { skip => 1 },
     'DBIx::Class::Componentised'                    => { skip => 1 },
     'DBIx::Class::Relationship::*'                  => { skip => 1 },
@@ -148,7 +141,7 @@ foreach my $module (@modules) {
         if exists($ex->{ignore});
 
     # run the test with the potentially modified parm set
-    pod_coverage_ok($module, $parms, "$module POD coverage");
+    Test::Pod::Coverage::pod_coverage_ok($module, $parms, "$module POD coverage");
   }
 }
 
index 145ad92..dc5f326 100644 (file)
@@ -5,10 +5,9 @@ use Test::More;
 use lib qw(t/lib);
 
 BEGIN {
-  eval { require Test::Memory::Cycle; require Devel::Cycle };
-  if ($@ or Devel::Cycle->VERSION < 1.10) {
-    plan skip_all => "leak test needs Test::Memory::Cycle and Devel::Cycle >= 1.10";
-  };
+  require DBIx::Class;
+  plan skip_all => 'Test needs: ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_cycle')
+    unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_cycle') );
 }
 
 use DBICTest;
index 4686876..8b6fc28 100644 (file)
@@ -7,11 +7,6 @@ use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-BEGIN {
-        eval "use DBD::SQLite";
-        plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 6);
-}                                                                               
-
 my $art = $schema->resultset("Artist")->find(1);
 
 isa_ok $art => 'DBICTest::Artist';
@@ -20,10 +15,10 @@ my $name = 'Caterwauler McCrae';
 
 ok($art->name($name) eq $name, 'update');
 
-{ 
+{
   my @changed_keys = $art->is_changed;
   is( scalar (@changed_keys), 0, 'field changed but same value' );
-}                                                                               
+}
 
 $art->discard_changes;
 
@@ -34,3 +29,5 @@ is($art->artistid, 100, 'pk mutation applied');
 my $art_100 = $schema->resultset("Artist")->find(100);
 $art_100->artistid(101);
 ok($art_100->update(), 'update allows pk mutation via column accessor');
+
+done_testing;
index 881668d..686161a 100644 (file)
@@ -7,11 +7,6 @@ use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 10);
-}
-
 # test LIMIT
 my $it = $schema->resultset("CD")->search( {},
     { rows => 3,
@@ -77,3 +72,4 @@ $it = $schema->resultset("CD")->search(
 );
 is( $it->count, 1, "complex abstract count ok" );
 
+done_testing;
index 0d5512e..862fef3 100644 (file)
@@ -10,13 +10,6 @@ my $schema = DBICTest->init_schema();
 
 my $orig_debug = $schema->storage->debug;
 
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 33 );
-}
-
 # test the abstract join => SQL generator
 my $sa = new DBIx::Class::SQLAHacks;
 
@@ -240,3 +233,5 @@ is($rs->first->name, 'We Are Goth', 'Correct record returned');
     is(cd_count(), 5, '5 rows in table cd');
     is(tk_count(), 3, '3 rows in table twokeys');
 }
+
+done_testing;
index 7487c72..5ba72a8 100644 (file)
@@ -18,12 +18,17 @@ BEGIN {
 # Test for SQLT-related leaks
 {
   my $s = DBICTest::Schema->clone;
-  create_schema ({ schema => $s });
+  my $sqlt_schema = create_schema ({ schema => $s });
   Scalar::Util::weaken ($s);
 
   ok (!$s, 'Schema not leaked');
+
+  isa_ok ($sqlt_schema, 'SQL::Translator::Schema', 'SQLT schema object produced');
 }
 
+# make sure classname-style works
+lives_ok { isa_ok (create_schema ({ schema => 'DBICTest::Schema' }), 'SQL::Translator::Schema', 'SQLT schema object produced') };
+
 
 my $schema = DBICTest->init_schema();
 # Dummy was yanked out by the sqlt hook test
index d7d9d28..34957de 100644 (file)
@@ -19,7 +19,7 @@ use DBICTest;
 
 use Path::Class;
 
-use ok 'DBIx::Class::Admin';
+use_ok 'DBIx::Class::Admin';
 
 
 my $sql_dir = dir(qw/t var/);
index 8bdd562..1fe59b7 100644 (file)
@@ -4,7 +4,6 @@ use warnings;
 use Test::More;
 
 use Test::Exception;
-use Test::Deep;
 
 BEGIN {
     require DBIx::Class;
@@ -15,7 +14,7 @@ BEGIN {
 use lib 't/lib';
 use DBICTest;
 
-use ok 'DBIx::Class::Admin';
+use_ok 'DBIx::Class::Admin';
 
 
 { # test data maniplulation functions
@@ -54,7 +53,7 @@ use ok 'DBIx::Class::Admin';
   ];
   my $data;
   lives_ok { $data = $admin->select('Employee')} 'can retrive data from database';
-  cmp_deeply($data, $expected_data, 'DB matches whats expected');
+  is_deeply($data, $expected_data, 'DB matches whats expected');
 
   $admin->delete('Employee', {name=>'Trout'});
   my $del_rs  = $employees->search({name => 'Trout'});
index c4f99c4..ca00c30 100644 (file)
@@ -9,13 +9,6 @@ use_ok('DBICTest');
 
 my $schema = DBICTest->init_schema;
 
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 13 );
-}
-
 my $where_bind = {
     where => \'name like ?',
     bind  => [ 'Cat%' ],
@@ -122,3 +115,5 @@ TODO: {
             bind => [ 'Spoon%' ] });
     is ( $rs->count, 1, '...cookbook + chained search with extra bind' );
 }
+
+done_testing;
index 398aa04..0b6716a 100644 (file)
@@ -6,13 +6,6 @@ use Test::More;
 use lib qw(t/lib);
 use DBIC::SqlMakerTest;
 
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 7 );
-}
-
 
 use_ok('DBICTest');
 use_ok('DBIC::DebugObj');
@@ -72,3 +65,5 @@ $schema->storage->sql_maker->quote_char('`');
 $schema->storage->sql_maker->name_sep('.');
 
 is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');
+
+done_testing;
index ccf1445..6d448ea 100644 (file)
@@ -6,13 +6,6 @@ use Test::More;
 use lib qw(t/lib);
 use DBIC::SqlMakerTest;
 
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 7 );
-}
-
 use_ok('DBICTest');
 use_ok('DBIC::DebugObj');
 
@@ -89,3 +82,5 @@ $schema->connection(
 );
 
 is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');
+
+done_testing;
index 2efb8d5..e57d892 100644 (file)
@@ -1,29 +1,20 @@
-use Class::C3;
 use strict;
-use Test::More;
 use warnings;
 
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 4 );
-}
+use Test::More;
+use Test::Warn;
+use Test::Exception;
 
 use lib qw(t/lib);
-
 use_ok( 'DBICTest' );
 use_ok( 'DBICTest::Schema' );
+
 my $schema = DBICTest->init_schema;
 
-{
-       my $warnings;
-       local $SIG{__WARN__} = sub { $warnings .= $_[0] };
-       eval {
-         $schema->resultset('CD')
-                ->create({ title => 'vacation in antarctica' })
-       };
-       like $@, qr/NULL/;  # as opposed to some other error
-       unlike( $warnings, qr/uninitialized value/, "No warning from Storage" );
-}
+warnings_are ( sub {
+  throws_ok (sub {
+    $schema->resultset('CD')->create({ title => 'vacation in antarctica' });
+  }, qr/NULL/);  # as opposed to some other error
+}, [], 'No warnings besides exception' );
 
+done_testing;