File: 04.auto_syntax.t

package info (click to toggle)
libclass-dbi-plugin-pager-perl 0.566-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 160 kB
  • ctags: 17
  • sloc: perl: 381; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 923 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 1;
use Test::Exception;

# this represents a single page of results
my @dataset = qw( fee fi fo foo fum );

{
    package TestApp;
    use base 'Class::DBI';

    use Class::DBI::Plugin::Pager;

    sub count_search_where { 27 }

    # the '@_' appends the class name, SQL and bind values passed in from
    # search_where_limitable
    sub retrieve_from_sql { @dataset, @_ }

    sub __driver { 'InterBase' } # RowsTo syntax

}


my $where = { this => 'that' };
my $order_by = [ 'fig' ];
my $per_page = scalar( @dataset );
my $page = 3;

my $pager = TestApp->pager;

my @results = $pager->search_where( $where, $order_by, $per_page, $page );

is_deeply( [ @results ], [ @dataset, 'TestApp', '( this = ? ) ORDER BY fig ROWS 10 TO 15', 'that' ], 'expected results for RowsTo' );


#use YAML;
#warn Dump( $pager );