X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frelationship%2Fcore.t;h=de6afd7c727593ecca5ff18a50494c863bbda913;hb=2d9a96fd40eb4be24a9a254953e1e3cd8e20ea3a;hp=87f635e6a2f876096d1ba85562753ef295639fcd;hpb=698313005dbb1ea5f0b19ce6cd7ea45ac01f16ef;p=dbsrgits%2FDBIx-Class.git diff --git a/t/relationship/core.t b/t/relationship/core.t index 87f635e..de6afd7 100644 --- a/t/relationship/core.t +++ b/t/relationship/core.t @@ -1,10 +1,12 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; use Test::Exception; use Test::Warn; -use lib qw(t/lib); + use DBICTest ':DiffSQL'; my $schema = DBICTest->init_schema(); @@ -137,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'} ); @@ -209,7 +195,8 @@ warnings_like { qr/\Qsearch( %condition ) is deprecated/ ], 'Warning properly bubbled from search()'; -$cd->set_producers([$schema->resultset('Producer')->all]); +# the undef-attr-arg at the end is deliberate: this is what FormFu does +$cd->set_producers([$schema->resultset('Producer')->all], undef); is( $cd->producers->count(), $prod_before_count+2, 'many_to_many set_$rel(\@objs) count ok' ); $cd->set_producers([$schema->resultset('Producer')->find(1)]);