Switch away the hook test from real tables (breaks DBICTEST_SQLT_DEPLOY=1)
Peter Rabbitson [Thu, 29 Jan 2009 09:39:36 +0000 (09:39 +0000)]
t/86sqlt.t
t/lib/DBICTest/Schema.pm
t/lib/DBICTest/Schema/Dummy.pm [new file with mode: 0644]

index ad9c480..3108c3f 100644 (file)
@@ -234,7 +234,7 @@ my %indexes = (
 my $tschema = $translator->schema();
 # Test that the $schema->sqlt_deploy_hook was called okay and that it removed
 # the 'link' table
-ok( !defined($tschema->get_table('link')), "Link table was removed by hook");
+ok( !defined($tschema->get_table('dummy')), "Dummy table was removed by hook");
 
 # Test that nonexistent constraints are not found
 my $constraint = get_constraint('FOREIGN KEY', 'cd', ['title'], 'cd', ['year']);
index 1681cf5..5695a1f 100644 (file)
@@ -33,6 +33,7 @@ __PACKAGE__->load_classes(qw/
     'ArtistSubclass',
     'Producer',
     'CD_to_Producer',
+    'Dummy',
   ),
   qw/SelfRefAlias TreeLike TwoKeyTreeLike Event EventTZ NoPrimaryKey/,
   qw/Collection CollectionObject TypedObject/,
@@ -43,7 +44,7 @@ __PACKAGE__->load_classes(qw/
 sub sqlt_deploy_hook {
   my ($self, $sqlt_schema) = @_;
 
-  $sqlt_schema->drop_table('link');
+  $sqlt_schema->drop_table('dummy');
 }
 
 1;
diff --git a/t/lib/DBICTest/Schema/Dummy.pm b/t/lib/DBICTest/Schema/Dummy.pm
new file mode 100644 (file)
index 0000000..6bc51d6
--- /dev/null
@@ -0,0 +1,23 @@
+package # hide from PAUSE
+    DBICTest::Schema::Dummy;
+
+use base 'DBIx::Class::Core';
+
+use strict;
+use warnings;
+
+__PACKAGE__->table('dummy');
+__PACKAGE__->add_columns(
+    'id' => {
+        data_type => 'integer',
+        is_auto_increment => 1
+    },
+    'gittery' => {
+        data_type => 'varchar',
+        size      => 100,
+        is_nullable => 1,
+    },
+);
+__PACKAGE__->set_primary_key('id');
+
+1;