Because prefetch uses the cache system, it is not possible to set HRI on a prefetched...
[dbsrgits/DBIx-Class-Historic.git] / t / 72pg.t
index 1156f21..b53916b 100644 (file)
--- a/t/72pg.t
+++ b/t/72pg.t
@@ -1,5 +1,5 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
 use Test::Exception;
@@ -49,9 +49,6 @@ plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test '.
   ' as well as following schemas: \'testschema\',\'anothertestschema\'!)'
     unless ($dsn && $user);
 
-
-plan tests => 41;
-
 DBICTest::Schema->load_classes( 'Casecheck', 'ArrayTest' );
 my $schema = DBICTest::Schema->connect($dsn, $user, $pass,);
 
@@ -108,9 +105,10 @@ is($storecolumn->storecolumn, '#a'); # was '##a'
 # This is in Core now, but it's here just to test that it doesn't break
 $schema->class('Artist')->load_components('PK::Auto');
 
+cmp_ok( $schema->resultset('Artist')->count, '==', 0, 'this should start with an empty artist table');
 
-{ #test that auto-pk also works with the defined search path by un-schema-qualifying
-  #the table name
+{ # test that auto-pk also works with the defined search path by
+  # un-schema-qualifying the table name
   my $artist_name_save = $schema->source("Artist")->name;
   $schema->source("Artist")->name("artist");
 
@@ -121,6 +119,17 @@ $schema->class('Artist')->load_components('PK::Auto');
 
   is($unq_new && $unq_new->artistid, 1, "and got correct artistid");
 
+  #test with anothertestschema
+  $schema->source('Artist')->name('anothertestschema.artist');
+  my $another_new = $schema->resultset('Artist')->create({ name => 'ribasushi'});
+  is( $another_new->artistid,1, 'got correct artistid for yetanotherschema');
+
+  #test with yetanothertestschema
+  $schema->source('Artist')->name('yetanothertestschema.artist');
+  my $yetanother_new = $schema->resultset('Artist')->create({ name => 'ribasushi'});
+  is( $yetanother_new->artistid,1, 'got correct artistid for yetanotherschema');
+  is( $yetanother_new->artistid,1, 'got correct artistid for yetanotherschema');
+
   $schema->source("Artist")->name($artist_name_save);
 }
 
@@ -320,4 +329,6 @@ sub _cleanup {
   }
 }
 
+done_testing;
+
 END { _cleanup($dbh) }