X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F90join_torture.t;h=a277475f8daa884140804ab1e592fc04f18bee7d;hb=ea78b3e678d829caee4ffc0d2555b4a2827667c6;hp=8d670921469c8d56c00f67fe457b39faec3f8941;hpb=1d78a406c9cbc81a8527607e00a81008bb537fc6;p=dbsrgits%2FDBIx-Class.git diff --git a/t/90join_torture.t b/t/90join_torture.t index 8d67092..a277475 100644 --- a/t/90join_torture.t +++ b/t/90join_torture.t @@ -4,10 +4,9 @@ use warnings; use Test::More; use lib qw(t/lib); use DBICTest; -use Data::Dumper; my $schema = DBICTest->init_schema(); -plan tests => 20; +plan tests => 22; { my $rs = $schema->resultset( 'CD' )->search( @@ -41,16 +40,11 @@ my @artists = $rs1->all; cmp_ok(@artists, '==', 2, "Two artists returned"); my $rs2 = $rs1->search({ artistid => '1' }, { join => {'cds' => {'cd_to_producer' => 'producer'} } }); -use Data::Dumper; print "attrs: " . Dumper($rs1->{attrs}) ; -use Data::Dumper; print "attrs: " . Dumper($rs2->{attrs}) ; - my @artists2 = $rs2->search({ 'producer.name' => 'Matt S Trout' }); my @cds = $artists2[0]->cds; cmp_ok(scalar @cds, '==', 1, "condition based on inherited join okay"); my $rs3 = $rs2->search_related('cds'); -use Data::Dumper; print "attrs: " . Dumper($rs2->{attrs}) ; -use Data::Dumper; print "attrs: " . Dumper($rs3->{attrs}) ; cmp_ok(scalar($rs3->all), '==', 45, "All cds for artist returned"); @@ -125,4 +119,10 @@ eval { ok(!$@, "pathological prefetch ok"); +my $rs = $schema->resultset("Artist")->search({}, { join => 'twokeys' }); +my $second_search_rs = $rs->search({ 'cds_2.cdid' => '2' }, { join => +['cds', 'cds'] }); +is(scalar(@{$second_search_rs->{attrs}->{join}}), 3, 'both joins kept'); +ok($second_search_rs->next, 'query on double joined rel runs okay'); + 1;