Commit | Line | Data |
46845551 |
1 | #!perl |
2 | |
3b599f0b |
3 | use Test::More tests => 3; |
46845551 |
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(); |
46845551 |
13 | is_deeply($artist_rs, [ |
14 | { |
15 | 'artistid' => '1', |
16 | 'name' => 'Caterwauler McCrae' |
17 | }, |
18 | { |
19 | 'artistid' => '2', |
20 | 'name' => 'Random Boy Band' |
21 | }, |
22 | { |
23 | 'artistid' => '3', |
24 | 'name' => 'We Are Goth' |
25 | } |
26 | ], 'ordered display returned as expected'); |
27 | } |
28 | |
29 | { |
30 | my $artists = $schema->resultset('Artist')->order_by(col => 'artistid')->with_substr->display(); |
31 | is_deeply($artists, [ |
32 | { |
33 | 'artistid' => '1', |
34 | 'name' => 'Caterwauler McCrae', |
35 | 'substr' => 'Cat' |
36 | }, |
37 | { |
38 | 'artistid' => '2', |
39 | 'name' => 'Random Boy Band', |
40 | 'substr' => 'Ran' |
41 | }, |
42 | { |
43 | 'artistid' => '3', |
44 | 'name' => 'We Are Goth', |
45 | 'substr' => 'We ' |
46 | } |
47 | ], 'display with substring okay'); |
48 | } |
49 | |
50 | |
51 | |