Commit | Line | Data |
46845551 |
1 | #!perl |
2 | |
3 | use Test::More tests => 2; |
4 | use lib qw(t/lib); |
5 | use DBICTest; |
6 | use Data::Dumper; |
7 | |
8 | # set up and populate schema |
9 | ok(my $schema = DBICTest->init_schema(), 'got schema'); |
10 | |
11 | { |
12 | my $artist_rs = $schema->resultset('Artist')->order_by(col => 'artistid')->display(); |
13 | warn Dumper($artist_rs); |
14 | is_deeply($artist_rs, [ |
15 | { |
16 | 'artistid' => '1', |
17 | 'name' => 'Caterwauler McCrae' |
18 | }, |
19 | { |
20 | 'artistid' => '2', |
21 | 'name' => 'Random Boy Band' |
22 | }, |
23 | { |
24 | 'artistid' => '3', |
25 | 'name' => 'We Are Goth' |
26 | } |
27 | ], 'ordered display returned as expected'); |
28 | } |
29 | |
30 | { |
31 | my $artists = $schema->resultset('Artist')->order_by(col => 'artistid')->with_substr->display(); |
32 | is_deeply($artists, [ |
33 | { |
34 | 'artistid' => '1', |
35 | 'name' => 'Caterwauler McCrae', |
36 | 'substr' => 'Cat' |
37 | }, |
38 | { |
39 | 'artistid' => '2', |
40 | 'name' => 'Random Boy Band', |
41 | 'substr' => 'Ran' |
42 | }, |
43 | { |
44 | 'artistid' => '3', |
45 | 'name' => 'We Are Goth', |
46 | 'substr' => 'We ' |
47 | } |
48 | ], 'display with substring okay'); |
49 | } |
50 | |
51 | |
52 | |