use strict;
-use warnings;
+use warnings;
use Test::More;
use Test::Exception;
' 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,);
# 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");
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);
}
}
}
+done_testing;
+
END { _cleanup($dbh) }