[Bast-commits] r6232 - DBIx-Class/0.08/trunk/t

debolaz at dev.catalyst.perl.org debolaz at dev.catalyst.perl.org
Tue May 12 15:17:10 GMT 2009


Author: debolaz
Date: 2009-05-12 15:17:09 +0000 (Tue, 12 May 2009)
New Revision: 6232

Modified:
   DBIx-Class/0.08/trunk/t/71mysql.t
Log:
Test for failing code related to many to many in MySQL


Modified: DBIx-Class/0.08/trunk/t/71mysql.t
===================================================================
--- DBIx-Class/0.08/trunk/t/71mysql.t	2009-05-12 13:20:31 UTC (rev 6231)
+++ DBIx-Class/0.08/trunk/t/71mysql.t	2009-05-12 15:17:09 UTC (rev 6232)
@@ -2,6 +2,7 @@
 use warnings;  
 
 use Test::More;
+use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
 use DBI::Const::GetInfoType;
@@ -13,7 +14,7 @@
 plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
   unless ($dsn && $user);
 
-plan tests => 10;
+plan tests => 11;
 
 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
 
@@ -23,6 +24,18 @@
 
 $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), rank INTEGER NOT NULL DEFAULT '13', charfield CHAR(10));");
 
+$dbh->do("DROP TABLE IF EXISTS cd;");
+
+$dbh->do("CREATE TABLE cd (cdid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, artist INTEGER, title TEXT, year INTEGER, genreid INTEGER, single_track INTEGER);");
+
+$dbh->do("DROP TABLE IF EXISTS producer;");
+
+$dbh->do("CREATE TABLE producer (producerid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name TEXT);");
+
+$dbh->do("DROP TABLE IF EXISTS cd_to_producer;");
+
+$dbh->do("CREATE TABLE cd_to_producer (cd INTEGER,producer INTEGER);");
+
 #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
 
 # This is in Core now, but it's here just to test that it doesn't break
@@ -119,8 +132,13 @@
     => 'Nothing Found!';
 }
     
+my $cd = $schema->resultset ('CD')->create ({});
 
+my $producer = $schema->resultset ('Producer')->create ({});
+
+lives_ok { $cd->set_producers ([ $cd ]) } 'set_relationship doesnt die';
+
 # clean up our mess
 END {
     #$dbh->do("DROP TABLE artist") if $dbh;
-}
\ No newline at end of file
+}




More information about the Bast-commits mailing list