X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frun%2F16joins.tl;h=cab0a9319e5eabce34759a0b1f3cb0f03423e339;hb=8452e496;hp=e9aabc94badc5b330c8450d93e5619adcea857b3;hpb=3712e4f41b929456d8fad713ca702e4a48e9a940;p=dbsrgits%2FDBIx-Class.git diff --git a/t/run/16joins.tl b/t/run/16joins.tl index e9aabc9..cab0a93 100644 --- a/t/run/16joins.tl +++ b/t/run/16joins.tl @@ -6,7 +6,7 @@ BEGIN { eval "use DBD::SQLite"; plan $@ ? ( skip_all => 'needs DBD::SQLite for testing' ) - : ( tests => 22 ); + : ( tests => 23 ); } # test the abstract join => SQL generator @@ -81,6 +81,13 @@ cmp_ok( $rs->count, '==', 1, "Single record in resultset"); is($rs->first->title, 'Come Be Depressed With Us', 'Correct record returned'); +# when using join attribute, make sure slice()ing all objects has same count as all() +$rs = DBICTest->class("CD")->search( + { 'artist' => 1 }, + { join => [qw/artist/], order_by => 'artist.name' } +); +cmp_ok( scalar $rs->all, '==', scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' ); + $rs = DBICTest->class("Artist")->search( { 'liner_notes.notes' => 'Kill Yourself!' }, { join => { 'cds' => 'liner_notes' } }); @@ -89,17 +96,6 @@ cmp_ok( $rs->count, '==', 1, "Single record in resultset"); is($rs->first->name, 'We Are Goth', 'Correct record returned'); -DBICTest::Schema::CD->add_relationship( - artist => 'DBICTest::Schema::Artist', - { 'foreign.artistid' => 'self.artist' }, - { accessor => 'filter' }, -); - -DBICTest::Schema::CD->add_relationship( - liner_notes => 'DBICTest::Schema::LinerNotes', - { 'foreign.liner_id' => 'self.cdid' }, - { join_type => 'LEFT', accessor => 'single' }); - $rs = DBICTest->class("CD")->search( { 'artist.name' => 'Caterwauler McCrae' }, { prefetch => [ qw/artist liner_notes/ ],