[Jifty-commit] r2566 - Jifty-DBI/trunk/t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Jan 26 01:42:18 EST 2007


Author: clkao
Date: Fri Jan 26 01:42:17 2007
New Revision: 2566

Modified:
   Jifty-DBI/trunk/t/01records.t
   Jifty-DBI/trunk/t/01searches.t
   Jifty-DBI/trunk/t/02-column_constraints.t
   Jifty-DBI/trunk/t/02records_cachable.t
   Jifty-DBI/trunk/t/02records_object.t
   Jifty-DBI/trunk/t/04memcached.t
   Jifty-DBI/trunk/t/06filter_datetime.t
   Jifty-DBI/trunk/t/06filter_truncate.t
   Jifty-DBI/trunk/t/06filter_utf8.t
   Jifty-DBI/trunk/t/11schema_records.t
   Jifty-DBI/trunk/t/12prefetch.t

Log:
Modernize tests to use Jifty::DBI::Record schema {...} for schema.

Modified: Jifty-DBI/trunk/t/01records.t
==============================================================================
--- Jifty-DBI/trunk/t/01records.t	(original)
+++ Jifty-DBI/trunk/t/01records.t	Fri Jan 26 01:42:17 2007
@@ -274,9 +274,9 @@
 
 1;
 
-package TestApp::Address::Schema;
 BEGIN {
 use Jifty::DBI::Schema;
+use Jifty::DBI::Record schema {
 
 column name =>
   type is 'varchar(14)';
@@ -291,5 +291,6 @@
 column employee_id =>
   type is 'int(8)';
 }
+}
 1;
 

Modified: Jifty-DBI/trunk/t/01searches.t
==============================================================================
--- Jifty-DBI/trunk/t/01searches.t	(original)
+++ Jifty-DBI/trunk/t/01searches.t	Fri Jan 26 01:42:17 2007
@@ -259,14 +259,14 @@
 
 1;
 
-package TestApp::User::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
-
+    use Jifty::DBI::Record schema {
     column login   => type is 'varchar(18)';
     column name    => type is 'varchar(36)';
     column phone   => type is 'varchar(18)', default is undef;
     column address => type is 'varchar(18)', default is '';
+    }
 }
 
 1;

Modified: Jifty-DBI/trunk/t/02-column_constraints.t
==============================================================================
--- Jifty-DBI/trunk/t/02-column_constraints.t	(original)
+++ Jifty-DBI/trunk/t/02-column_constraints.t	Fri Jan 26 01:42:17 2007
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 use File::Spec;
-use Test::More;
+use Test::More;# import => [qw(isa_ok skip plan)];
 
 BEGIN { require "t/utils.pl" }
 our (@available_drivers);
@@ -91,13 +91,10 @@
 
 
 package TestApp::Employee;
-use base qw/Jifty::DBI::Record/;
 
-1;
-
-package TestApp::Employee::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
+    use Jifty::DBI::Record schema {
 
     column name => type is 'varchar(18)',
         is mandatory;
@@ -105,6 +102,7 @@
     column employee_num =>
         type is 'int(8)',
         is distinct;
+    }
 }
 
 1;

Modified: Jifty-DBI/trunk/t/02records_cachable.t
==============================================================================
--- Jifty-DBI/trunk/t/02records_cachable.t	(original)
+++ Jifty-DBI/trunk/t/02records_cachable.t	Fri Jan 26 01:42:17 2007
@@ -173,11 +173,12 @@
 
 1;
 
-package TestApp::Address::Schema;
+package TestApp::Address;
 
 BEGIN {
     use Jifty::DBI::Schema;
 
+    use Jifty::DBI::Record schema {
     column name => type is 'varchar(14)';
 
     column phone => type is 'varchar(18)';
@@ -187,5 +188,6 @@
         default is '';
 
     column employee_id => type is 'int(8)';
+    }
 }
 1;

Modified: Jifty-DBI/trunk/t/02records_object.t
==============================================================================
--- Jifty-DBI/trunk/t/02records_object.t	(original)
+++ Jifty-DBI/trunk/t/02records_object.t	Fri Jan 26 01:42:17 2007
@@ -103,15 +103,12 @@
 
 
 package TestApp::Employee;
-use base qw/Jifty::DBI::Record/;
 
-1;
-
-package TestApp::Employee::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
-
+    use Jifty::DBI::Record schema {
     column name => type is 'varchar(18)';
+    }
 }
 
 1;
@@ -119,16 +116,12 @@
 
 
 package TestApp::Phone;
-use base qw/Jifty::DBI::Record/;
-
-1;
-
-package TestApp::Phone::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
-
+    use Jifty::DBI::Record schema {
     column employee => refers_to TestApp::Employee;
-    column phone    => type 'varchar(18)';
+    column phone    => type is 'varchar(18)';
+    }
 }
 
 1;

Modified: Jifty-DBI/trunk/t/04memcached.t
==============================================================================
--- Jifty-DBI/trunk/t/04memcached.t	(original)
+++ Jifty-DBI/trunk/t/04memcached.t	Fri Jan 26 01:42:17 2007
@@ -119,12 +119,9 @@
 
 }
 
-1;
-
-package TestApp::Address::Schema;
-
 BEGIN {
     use Jifty::DBI::Schema;
+    use Jifty::DBI::Record schema {
 
     column name => type is 'varchar(14)';
 
@@ -135,5 +132,6 @@
         default is '';
 
     column employee_id => type is 'int(8)';
+    }
 }
 1;

Modified: Jifty-DBI/trunk/t/06filter_datetime.t
==============================================================================
--- Jifty-DBI/trunk/t/06filter_datetime.t	(original)
+++ Jifty-DBI/trunk/t/06filter_datetime.t	Fri Jan 26 01:42:17 2007
@@ -108,10 +108,10 @@
 
 }
 
-package TestApp::User::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
-    
+
+    use Jifty::DBI::Record schema {
     column created =>
       type is 'datetime',
       input_filters are qw/Jifty::DBI::Filter::DateTime/;
@@ -123,9 +123,8 @@
     column event_stops =>
       type is 'time',
       input_filters are qw/Jifty::DBI::Filter::Time/;
+    }
 }
 
 1;
 
-1;
-

Modified: Jifty-DBI/trunk/t/06filter_truncate.t
==============================================================================
--- Jifty-DBI/trunk/t/06filter_truncate.t	(original)
+++ Jifty-DBI/trunk/t/06filter_truncate.t	Fri Jan 26 01:42:17 2007
@@ -131,10 +131,10 @@
 
 1;
 
-package TestApp::User::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
 
+    use Jifty::DBI::Record schema {
     # special small lengths to test truncation
     column login =>
       type is 'varchar(5)',
@@ -149,6 +149,7 @@
       type is 'int(4)',
       length is 4,
       default is 0;
+    }
 }
 
 1;

Modified: Jifty-DBI/trunk/t/06filter_utf8.t
==============================================================================
--- Jifty-DBI/trunk/t/06filter_utf8.t	(original)
+++ Jifty-DBI/trunk/t/06filter_utf8.t	Fri Jan 26 01:42:17 2007
@@ -126,12 +126,12 @@
 
 }
 
-package TestApp::User::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
-
+    use Jifty::DBI::Record schema {
     column name      => type is 'varchar(5)';
     column signature => type is 'varchar(100)';
+    }
 }
 
 1;

Modified: Jifty-DBI/trunk/t/11schema_records.t
==============================================================================
--- Jifty-DBI/trunk/t/11schema_records.t	(original)
+++ Jifty-DBI/trunk/t/11schema_records.t	Fri Jan 26 01:42:17 2007
@@ -250,18 +250,6 @@
 } ]
 }
 
-package TestApp::Employee;
-use base qw/Jifty::DBI::Record/;
-
-sub _value  {
-  my $self = shift;
-  my $x =  ($self->__value(@_));
-  return $x;
-}
-
-package TestApp::Phone;
-use base qw/Jifty::DBI::Record/;
-
 package TestApp::PhoneCollection;
 use base qw/Jifty::DBI::Collection/;
 
@@ -271,19 +259,32 @@
     return $tab;
 }
 
+package TestApp::Employee;
+use base qw/Jifty::DBI::Record/;
 
-package TestApp::Phone::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
-    column employee => refers_to TestApp::Employee;
-    column phone    => type 'varchar';
+    use Jifty::DBI::Record schema {
+    column name => type is 'varchar';
+    column phones => refers_to TestApp::PhoneCollection by 'employee';
+    }
 }
 
-package TestApp::Employee::Schema;
+sub _value  {
+  my $self = shift;
+  my $x =  ($self->__value(@_));
+  return $x;
+}
+
+
+package TestApp::Phone;
+
 BEGIN {
     use Jifty::DBI::Schema;
-    column name => type 'varchar';
-    column phones => refers_to TestApp::PhoneCollection by 'employee';
+    use Jifty::DBI::Record schema {;
+    column employee => refers_to TestApp::Employee;
+    column phone    => type is 'varchar';
+    }
 }
 
 

Modified: Jifty-DBI/trunk/t/12prefetch.t
==============================================================================
--- Jifty-DBI/trunk/t/12prefetch.t	(original)
+++ Jifty-DBI/trunk/t/12prefetch.t	Fri Jan 26 01:42:17 2007
@@ -4,15 +4,15 @@
 use strict;
 use warnings;
 use File::Spec;
-use Test::More 'no_plan';
+use Test::More;
 
 BEGIN { require "t/utils.pl" }
 our (@available_drivers);
-
-use constant TESTS_PER_DRIVER => 67;
+use constant TESTS_PER_DRIVER => 41;
 
 my $total = scalar(@available_drivers) * TESTS_PER_DRIVER;
 #plan tests => $total;
+plan tests => TESTS_PER_DRIVER;
 
 foreach my $d ('SQLite'){ # @available_drivers ) {
 SKIP: {
@@ -160,17 +160,6 @@
 } ]
 }
 
-package TestApp::Employee;
-use base qw/Jifty::DBI::Record/;
-
-sub _value  {
-  my $self = shift;
-  my $x =  ($self->__value(@_));
-  return $x;
-}
-
-package TestApp::Phone;
-use base qw/Jifty::DBI::Record/;
 
 package TestApp::PhoneCollection;
 use base qw/Jifty::DBI::Collection/;
@@ -182,20 +171,33 @@
 }
 
 
-package TestApp::Phone::Schema;
-BEGIN {
-    use Jifty::DBI::Schema;
-    column employee => refers_to TestApp::Employee;
-    column phone    => type 'varchar';
+package TestApp::Employee;
+use base qw/Jifty::DBI::Record/;
+
+sub _value  {
+  my $self = shift;
+  my $x =  ($self->__value(@_));
+  return $x;
 }
 
-package TestApp::Employee::Schema;
 BEGIN {
     use Jifty::DBI::Schema;
+    use Jifty::DBI::Record schema {
     column name => type 'varchar';
     column phones => refers_to TestApp::PhoneCollection by 'employee';
+    }
 }
 
+package TestApp::Phone;
+use base qw/Jifty::DBI::Record/;
+
+BEGIN {
+    use Jifty::DBI::Schema;
+    use Jifty::DBI::Record schema {
+    column employee => refers_to TestApp::Employee;
+    column phone    => type 'varchar';
+    }
+}
 
 package TestApp::EmployeeCollection;
 


More information about the Jifty-commit mailing list