From: Robert Sedlacek Date: Thu, 1 Oct 2015 03:50:23 +0000 (+0000) Subject: ensure unconstrained relations don't show problems X-Git-Tag: v0.000001~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb0b3e7b5f9685559ac67b9bed87042ea709e882;p=dbsrgits%2FDBIx-Class-ParameterizedJoinHack.git ensure unconstrained relations don't show problems --- diff --git a/t/00basic.t b/t/00basic.t index 8b58399..a10ec9d 100644 --- a/t/00basic.t +++ b/t/00basic.t @@ -109,6 +109,14 @@ subtest 'has_many' => sub { 2*3, 'full count'; }; + subtest 'unconstrained' => sub { + is $people + ->with_parameterized_join(unconstrained_tasks => {}) + ->$search_count('unconstrained_tasks.id') + ->$fetch_count, + 3, 'unconstrained count'; + }; + subtest 'errors' => sub { like exception { $people->with_parameterized_join(urgent_assigned_tasks => {}) diff --git a/t/lib/My/Schema/Result/Person.pm b/t/lib/My/Schema/Result/Person.pm index 88c11ca..1206d84 100644 --- a/t/lib/My/Schema/Result/Person.pm +++ b/t/lib/My/Schema/Result/Person.pm @@ -50,6 +50,18 @@ __PACKAGE__->parameterized_has_many( ] ); +__PACKAGE__->parameterized_has_many( + unconstrained_tasks => 'My::Schema::Result::Task', + [ [], sub { + my $args = shift; + +{ + "$args->{foreign_alias}.assigned_to_id" => + { -ident => "$args->{self_alias}.id" }, + } + } + ] +); + our %ERROR; my $_catch_fail = sub { my $key = shift;