8 # set up and populate schema
9 ok(my $schema = DBICTest->init_schema(), 'got schema');
12 my $artist_rs = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->display();
13 is_deeply($artist_rs, [
16 'name' => 'Caterwauler McCrae'
20 'name' => 'Random Boy Band'
24 'name' => 'We Are Goth'
26 ], 'ordered display returned as expected');
30 my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_multi->display();
34 'name' => 'Caterwauler McCrae',
40 'name' => 'Random Boy Band',
46 'name' => 'We Are Goth',
50 ], 'display with substring using _with_meta_hash okay');
54 my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_multi_object->display();
58 'name' => 'Caterwauler McCrae',
64 'name' => 'Random Boy Band',
70 'name' => 'We Are Goth',
74 ], 'display with substring using _with_object_meta_hash okay');
78 my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_key->display();
82 'name' => 'Caterwauler McCrae',
87 'name' => 'Random Boy Band',
92 'name' => 'We Are Goth',
95 ], 'display with substring using _with_meta_key okay');
99 my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_key_obj->display();
100 is_deeply($artists, [
103 'name' => 'Caterwauler McCrae',
108 'name' => 'Random Boy Band',
113 'name' => 'We Are Goth',
116 ], 'display with substring using _with_object_meta_key okay');
120 # my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_old->display();
121 # is_deeply($artists, [
124 # 'name' => 'Caterwauler McCrae',
129 # 'name' => 'Random Boy Band',
134 # 'name' => 'We Are Goth',
137 # ], 'display with substring okay');
141 my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_key->search({}, { prefetch => 'cds', rows => 1 })->display();
142 is_deeply($artists, [
149 'title' => 'Caterwaulin\' Blues',
155 'title' => 'Spoonful of bees',
161 'title' => 'Forkful of bees',
165 'name' => 'Caterwauler McCrae',
168 ], 'substring before prefetch okay');