10 # perl -le'my $letter = 'a'; for my $i (4..10000) { $letter++; print "[ $i, \"$letter\" ]," }' > tests.txt
12 my $schema = DBICTest->init_schema();
13 $schema->populate('Artist', [
14 [ qw/artistid name/ ],
10015 ## make sure populate honors fields/orders in list context
10017 my @links = $schema->populate('Link', [
10018 [ qw/id url title/ ],
10019 [ qw/2 burl btitle/ ]
10021 is(scalar @links, 1);
10023 my $link2 = shift @links;
10024 is($link2->id, 2, 'Link 2 id');
10025 is($link2->url, 'burl', 'Link 2 url');
10026 is($link2->title, 'btitle', 'Link 2 title');
10028 ## non-schema order
10029 @links = $schema->populate('Link', [
10030 [ qw/id title url/ ],
10031 [ qw/3 ctitle curl/ ]
10033 is(scalar @links, 1);
10035 my $link3 = shift @links;
10036 is($link3->id, 3, 'Link 3 id');
10037 is($link3->url, 'curl', 'Link 3 url');
10038 is($link3->title, 'ctitle', 'Link 3 title');
10040 ## not all physical columns
10041 @links = $schema->populate('Link', [
10045 is(scalar @links, 1);
10047 my $link4 = shift @links;
10048 is($link4->id, 4, 'Link 4 id');
10049 is($link4->url, undef, 'Link 4 url');
10050 is($link4->title, 'dtitle', 'Link 4 title');
10053 ## make sure populate -> insert_bulk honors fields/orders in void context
10055 $schema->populate('Link', [
10056 [ qw/id url title/ ],
10057 [ qw/5 eurl etitle/ ]
10059 my $link5 = $schema->resultset('Link')->find(5);
10060 is($link5->id, 5, 'Link 5 id');
10061 is($link5->url, 'eurl', 'Link 5 url');
10062 is($link5->title, 'etitle', 'Link 5 title');
10064 ## non-schema order
10065 $schema->populate('Link', [
10066 [ qw/id title url/ ],
10067 [ qw/6 ftitle furl/ ]
10069 my $link6 = $schema->resultset('Link')->find(6);
10070 is($link6->id, 6, 'Link 6 id');
10071 is($link6->url, 'furl', 'Link 6 url');
10072 is($link6->title, 'ftitle', 'Link 6 title');
10074 ## not all physical columns
10075 $schema->populate('Link', [
10079 my $link7 = $schema->resultset('Link')->find(7);
10080 is($link7->id, 7, 'Link 7 id');
10081 is($link7->url, undef, 'Link 7 url');
10082 is($link7->title, 'gtitle', 'Link 7 title');