8 my $schema = DBICTest->init_schema();
13 my $it = $schema->resultset("CD")->search(
15 { order_by => 'title',
20 is( $it->pager->entries_on_this_page, 3, "entries_on_this_page ok" );
22 is( $it->pager->next_page, 2, "next_page ok" );
24 is( $it->count, 3, "count on paged rs ok" );
26 is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
31 is( $it->next, undef, "next past end of page ok" );
33 # second page, testing with array
34 my @page2 = $schema->resultset("CD")->search(
36 { order_by => 'title',
41 is( $page2[0]->title, "Generic Manufactured Singles", "second page first title ok" );
43 # page a standard resultset
44 $it = $schema->resultset("CD")->search(
46 { order_by => 'title',
49 my $page = $it->page(2);
51 is( $page->count, 2, "standard resultset paged rs count ok" );
53 is( $page->next->title, "Generic Manufactured Singles", "second page of standard resultset ok" );
55 # test software-based limit paging
56 $it = $schema->resultset("CD")->search(
58 { order_by => 'title',
63 is( $it->pager->entries_on_this_page, 2, "software entries_on_this_page ok" );
65 is( $it->pager->previous_page, 1, "software previous_page ok" );
67 is( $it->count, 2, "software count on paged rs ok" );
69 is( $it->next->title, "Generic Manufactured Singles", "software iterator->next ok" );
71 # test paging with chained searches
72 $it = $schema->resultset("CD")->search(
76 )->search( undef, { order_by => 'title' } );
78 is( $it->count, 2, "chained searches paging ok" );