X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F10_02mysql_common.t;h=948d2c475249099613887a20b179a5020942983c;hb=9dedee1fe26880cb3ef739a22bc7fcba6f412afa;hp=67af3eeb6644987533a2fbd5b009c92ebb8c4ef6;hpb=c53aa7b7f2563a3d543da23ce131b815e6f11106;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/10_02mysql_common.t b/t/10_02mysql_common.t index 67af3ee..948d2c4 100644 --- a/t/10_02mysql_common.t +++ b/t/10_02mysql_common.t @@ -180,10 +180,24 @@ my $tester = dbixcsl_common_tests->new( PRIMARY KEY (`ISO3_code`) ) $innodb }, + # 4 through 10 are used for the multi-schema tests + qq{ + create table mysql_loader_test11 ( + id int auto_increment primary key + ) $innodb + }, + qq{ + create table mysql_loader_test12 ( + id int auto_increment primary key, + eleven_id int, + foreign key (eleven_id) references mysql_loader_test11(id) + on delete restrict on update set null + ) $innodb + }, ], pre_drop_ddl => [ 'DROP VIEW mysql_loader_test2', ], - drop => [ 'mysql_loader-test1', 'mysql_loader_test3' ], - count => 5 + 30 * 2, + drop => [ 'mysql_loader-test1', 'mysql_loader_test3', 'mysql_loader_test11', 'mysql_loader_test12' ], + count => 8 + 30 * 2, run => sub { my ($monikers, $classes); ($schema, $monikers, $classes) = @_; @@ -212,6 +226,17 @@ my $tester = dbixcsl_common_tests->new( like $code, qr/^=head2 id\n\n(.+:.+\n)+\nThe\nColumn\n\n/m, 'column comment and attrs'; + # test on delete/update fk clause introspection + ok ((my $rel_info = $schema->source('MysqlLoaderTest12')->relationship_info('eleven')), + 'got rel info'); + + is $rel_info->{attrs}{on_delete}, 'RESTRICT', + 'ON DELETE clause introspected correctly'; + + is $rel_info->{attrs}{on_update}, 'SET NULL', + 'ON UPDATE clause introspected correctly'; + + # multischema tests follow SKIP: { my $dbh = $schema->storage->dbh;