X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F67pager.t;h=b7bb73f480bab1712492f7fe93d12f3f894250f0;hb=473441327e8b9ef1c9d70fc30fe03c3c18bf8ecd;hp=85b1e8d3fccab6c507abfeb0a6cdfb1eeda60dce;hpb=d6915f449e2d68ac184d6bc616043fd605913757;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/67pager.t b/t/67pager.t index 85b1e8d..b7bb73f 100644 --- a/t/67pager.t +++ b/t/67pager.t @@ -1,13 +1,11 @@ use strict; use warnings; -use Test::More; +use Test::More qw(no_plan); use lib qw(t/lib); use DBICTest; -my $schema = DBICTest::init_schema(); - -plan tests => 12; +my $schema = DBICTest->init_schema(); # first page my $it = $schema->resultset("CD")->search( @@ -68,3 +66,19 @@ is( $it->count, 2, "software count on paged rs ok" ); is( $it->next->title, "Generic Manufactured Singles", "software iterator->next ok" ); +# test paging with chained searches +$it = $schema->resultset("CD")->search( + {}, + { rows => 2, + page => 2 } +)->search( undef, { order_by => 'title' } ); + +is( $it->count, 2, "chained searches paging ok" ); + +my $p = sub { $schema->resultset("CD")->page(1)->pager->entries_per_page; }; + +is($p->(), 10, 'default rows is 10'); + +$schema->default_resultset_attributes({ rows => 5 }); + +is($p->(), 5, 'default rows is 5');