1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2 use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
12 DBICTest::Schema::CD->load_components(qw/CDBICompat CDBICompat::Pager/);
14 my $schema = DBICTest->init_schema(compose_connection => 1);
16 DBICTest::CD->result_source_instance->schema->storage($schema->storage);
18 my ( $pager, $it ) = DBICTest::CD->page(
20 { order_by => 'title',
24 cmp_ok( $pager->entries_on_this_page, '==', 3, "entries_on_this_page ok" );
26 cmp_ok( $pager->next_page, '==', 2, "next_page ok" );
28 is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
33 is( $it->next, undef, "next past end of page ok" );
35 ( $pager, $it ) = DBICTest::CD->page(
39 disable_sql_paging => 1 } );
41 cmp_ok( $pager->total_entries, '==', 5, "disable_sql_paging total_entries ok" );
43 cmp_ok( $pager->previous_page, '==', 1, "disable_sql_paging previous_page ok" );
45 is( $it->next->title, "Caterwaulin' Blues", "disable_sql_paging iterator->next ok" );
49 is( $it->next, undef, "disable_sql_paging next past end of page ok" );
51 # based on a failing criteria submitted by waswas
52 ( $pager, $it ) = DBICTest::CD->page(
59 -not_like => 'Forkful%'
65 is( $it->count, 1, "complex abstract count ok" );