X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frun%2F01core.tl;h=a03833260f3bd3e1952d8f83305fb5c1b9a80536;hb=6aeb91850d436202eecee51d6c51c8e548961105;hp=95138a1a166d39c21247c43f2494f394fa76ab77;hpb=b52e9bf8ba1cd1fb4aa707615a6b2564de04cb8a;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/run/01core.tl b/t/run/01core.tl index 95138a1..a038332 100644 --- a/t/run/01core.tl +++ b/t/run/01core.tl @@ -1,6 +1,6 @@ sub run_tests { -plan tests => 31; +plan tests => 33; my @art = DBICTest->class("Artist")->search({ }, { order_by => 'name DESC'}); @@ -116,13 +116,23 @@ is(DBICTest->class("Artist")->field_name_for->{name}, 'artist name', 'mk_classda my $search = [ { 'tags.tag' => 'Cheesy' }, { 'tags.tag' => 'Blue' } ]; -my $rs = DBICTest->class("CD")->search($search, { join => 'tags' }); +my $or_rs = DBICTest->class("CD")->search($search, { join => 'tags', + order_by => 'cdid' }); -cmp_ok($rs->all, '==', 5, 'Search with OR ok'); +cmp_ok($or_rs->count, '==', 5, 'Search with OR ok'); -$rs = DBICTest->class("CD")->search($search, { join => 'tags', distinct => 1 }); +my $distinct_rs = DBICTest->class("CD")->search($search, { join => 'tags', distinct => 1 }); -cmp_ok($rs->all, '==', 4, 'DISTINCT search with OR ok'); +cmp_ok($distinct_rs->all, '==', 4, 'DISTINCT search with OR ok'); + +my $tag_rs = DBICTest->class('Tag')->search( + [ { 'me.tag' => 'Cheesy' }, { 'me.tag' => 'Blue' } ]); + +my $rel_rs = $tag_rs->search_related('cd'); + +cmp_ok($rel_rs->count, '==', 5, 'Related search ok'); + +cmp_ok($or_rs->next->cdid, '==', $rel_rs->next->cdid, 'Related object ok'); }