From: Peter Rabbitson Date: Fri, 29 Apr 2016 11:00:35 +0000 (+0200) Subject: Pull apart a test section (no functional changes) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dad6d9e5a228e2d2252c55da913dd4c2b878ee72;p=dbsrgits%2FDBIx-Class.git Pull apart a test section (no functional changes) --- diff --git a/t/relationship/core.t b/t/relationship/core.t index 9955ce6..be8d7c9 100644 --- a/t/relationship/core.t +++ b/t/relationship/core.t @@ -139,22 +139,6 @@ throws_ok { $new_bookmark->new_related( no_such_rel => {} ); } qr/No such relationship 'no_such_rel'/, 'creating in uknown rel throws'; -{ - local $TODO = "relationship checking needs fixing"; - # try to add a bogus relationship using the wrong cols - throws_ok { - DBICTest::Schema::Artist->add_relationship( - tracks => 'DBICTest::Schema::Track', - { 'foreign.cd' => 'self.cdid' } - ); - } qr/Unknown column/, 'failed when creating a rel with invalid key, ok'; -} - -# another bogus relationship using no join condition -throws_ok { - DBICTest::Schema::Artist->add_relationship( tracks => 'DBICTest::Track' ); -} qr/join condition/, 'failed when creating a rel without join condition, ok'; - # many_to_many helper tests $cd = $schema->resultset("CD")->find(1); my @producers = $cd->producers(undef, { order_by => 'producerid'} ); diff --git a/xt/extra/diagnostics/add_invalid_relationship.t b/xt/extra/diagnostics/add_invalid_relationship.t new file mode 100644 index 0000000..6562489 --- /dev/null +++ b/xt/extra/diagnostics/add_invalid_relationship.t @@ -0,0 +1,28 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + +use strict; +use warnings; + +use Test::More; +use Test::Exception; + +use DBICTest; + +{ + local $TODO = "relationship checking needs fixing"; + # try to add a bogus relationship using the wrong cols + throws_ok { + DBICTest::Schema::Artist->add_relationship( + tracks => 'DBICTest::Schema::Track', + { 'foreign.cd' => 'self.cdid' } + ); + } qr/Unknown column/, 'failed when creating a rel with invalid key, ok'; +} + +# another bogus relationship using no join condition +throws_ok { + DBICTest::Schema::Artist->add_relationship( tracks => 'DBICTest::Track' ); +} qr/join condition/, 'failed when creating a rel without join condition, ok'; + + +done_testing;