X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F86sqlt.t;h=ad9c4803ab268f912dc3a199c795d1a08d5df485;hb=bbe552a3fbfa23dd300ee51c02dd10a112a4bd44;hp=c70be7415ceea57218665589abbabb0a4a03d231;hpb=17cab2f096f05c297fb7cd51fa1502616dabd844;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/86sqlt.t b/t/86sqlt.t index c70be74..ad9c480 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -10,7 +10,7 @@ plan skip_all => 'SQL::Translator required' if $@; my $schema = DBICTest->init_schema; -plan tests => 55; +plan tests => 60; my $translator = SQL::Translator->new( parser_args => { @@ -28,7 +28,6 @@ my $output = $translator->translate(); ok($output, "SQLT produced someoutput") or diag($translator->error); - # Note that the constraints listed here are the only ones that are tested -- if # more exist in the Schema than are listed here and all listed constraints are # correct, the test will still pass. If you add a class with UNIQUE or FOREIGN @@ -177,6 +176,16 @@ my %fk_constraints = ( on_delete => '', on_update => '', }, ], + # ForceForeign + forceforeign => [ + { + 'display' => 'forceforeign->artist', + 'selftable' => 'forceforeign', 'foreigntable' => 'artist', + 'selfcols' => ['artist'], 'foreigncols' => ['artist_id'], + on_delete => '', on_update => '', + }, + ], + ); my %unique_constraints = ( @@ -223,12 +232,17 @@ 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"); # Test that nonexistent constraints are not found my $constraint = get_constraint('FOREIGN KEY', 'cd', ['title'], 'cd', ['year']); ok( !defined($constraint), 'nonexistent FOREIGN KEY constraint not found' ); $constraint = get_constraint('UNIQUE', 'cd', ['artist']); ok( !defined($constraint), 'nonexistent UNIQUE constraint not found' ); +$constraint = get_constraint('FOREIGN KEY', 'forceforeign', ['cd'], 'cd', ['cdid']); +ok( !defined($constraint), 'forced nonexistent FOREIGN KEY constraint not found' ); for my $expected_constraints (keys %fk_constraints) { for my $expected_constraint (@{ $fk_constraints{$expected_constraints} }) {