X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F67pager.t;h=fa7c93a0e7668857a02037c805af202483379b6c;hb=261a9d64a6c252dd0b6609c023a982a8cb58655c;hp=eb17faa555743283dc95d1c7e0fe5fa85a9f18d8;hpb=cd1228209f685767668163c2510723959951641b;p=dbsrgits%2FDBIx-Class.git diff --git a/t/67pager.t b/t/67pager.t index eb17faa..fa7c93a 100644 --- a/t/67pager.t +++ b/t/67pager.t @@ -2,10 +2,8 @@ use strict; use warnings; use Test::More; -use Test::Exception; use lib qw(t/lib); use DBICTest; -use Storable qw/dclone/; my $schema = DBICTest->init_schema(); @@ -71,12 +69,14 @@ $it = $rs->search( { order_by => 'title', rows => 3 } ); -my $page = $it->page(2); -is( $page->count, 2, "standard resultset paged rs count ok" ); +{ + my $page = $it->page(2); -is( $page->next->title, "Generic Manufactured Singles", "second page of standard resultset ok" ); + is( $page->count, 2, "standard resultset paged rs count ok" ); + is( $page->next->title, "Generic Manufactured Singles", "second page of standard resultset ok" ); +} # test software-based limit paging $it = $rs->search( @@ -112,7 +112,7 @@ $it = $rs->search({}, { }); my $row = $rs->search({}, { - order_by => 'cdid', + order_by => 'cdid', offset => 3, rows => 1 })->single; @@ -198,7 +198,11 @@ $it = $rs->search( $pager = $it->pager; is ($qcnt, 0, 'No queries on rs/pager creation'); -$it = do { local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema; dclone ($it) }; +# test *requires* it to be Storable +$it = do { + local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema; + Storable::dclone ($it); +}; is ($qcnt, 0, 'No queries on rs/pager freeze/thaw'); is( $it->pager->entries_on_this_page, 1, "entries_on_this_page ok for page 2" ); @@ -208,7 +212,11 @@ is ($qcnt, 1, 'Count fired to get pager page entries'); $rs->create({ title => 'bah', artist => 1, year => 2011 }); $qcnt = 0; -$it = do { local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema; dclone ($it) }; +# test *requires* it to be Storable +$it = do { + local $DBIx::Class::ResultSourceHandle::thaw_schema = $schema; + Storable::dclone ($it); +}; is ($qcnt, 0, 'No queries on rs/pager freeze/thaw'); is( $it->pager->entries_on_this_page, 1, "entries_on_this_page ok for page 2, even though underlying count changed" );