From: Justin Guenther Date: Mon, 28 Aug 2006 08:02:19 +0000 (+0000) Subject: added tests for many_to_many set_$rel(\@objs) X-Git-Tag: v0.07002~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21c45f7bbd6b55a7f83e27ae845efdd1a32fa1c7;p=dbsrgits%2FDBIx-Class.git added tests for many_to_many set_$rel(\@objs) --- diff --git a/t/66relationship.t b/t/66relationship.t index 406e289..73925d4 100644 --- a/t/66relationship.t +++ b/t/66relationship.t @@ -7,7 +7,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 54; +plan tests => 56; # has_a test my $cd = $schema->resultset("CD")->find(4); @@ -162,6 +162,11 @@ is( $cd->producers->count(), $prod_before_count+2, 'many_to_many set_$rel(@objs) count ok' ); $cd->set_producers($schema->resultset('Producer')->find(1)); is( $cd->producers->count(), 1, 'many_to_many set_$rel($obj) count ok' ); +$cd->set_producers([$schema->resultset('Producer')->all]); +is( $cd->producers->count(), $prod_before_count+2, + 'many_to_many set_$rel(\@objs) count ok' ); +$cd->set_producers([$schema->resultset('Producer')->find(1)]); +is( $cd->producers->count(), 1, 'many_to_many set_$rel([$obj]) count ok' ); eval { $cd->remove_from_producers({ fake => 'hash' }); }; like( $@, qr/needs an object/, 'remove_from_$rel($hash) dies correctly' );