From: Christopher H. Laco Date: Thu, 28 Sep 2006 22:53:36 +0000 (+0000) Subject: Added failing tests for pre/post populate->insert_bulk changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b045741571a31f6bdc5a76c7fbc5ba388d57bb1c;p=dbsrgits%2FDBIx-Class-Historic.git Added failing tests for pre/post populate->insert_bulk changes --- diff --git a/t/100populate.t b/t/100populate.t index 296227c..bcd6bfe 100644 --- a/t/100populate.t +++ b/t/100populate.t @@ -5,7 +5,7 @@ use Test::More; use lib qw(t/lib); use DBICTest; -plan tests => 1; +plan tests => 10; # perl -le'my $letter = 'a'; for my $i (4..10000) { $letter++; print "[ $i, \"$letter\" ]," }' > tests.txt @@ -10011,4 +10011,38 @@ $schema->populate('Artist', [ [ 10000, "ntn" ], ]); + +## make sure populate -> insert_bulk honors fields/orders +## schema order +$schema->populate('Link', [ +[ qw/id url title/ ], +[ qw/2 burl btitle/ ] +]); +my $link2 = $schema->resultset('Link')->find(2); +is($link2->id, 2, 'Link 2 id'); +is($link2->url, 'burl', 'Link 2 url'); +is($link2->title, 'btitle', 'Link 2 title'); + +## non-schema order +$schema->populate('Link', [ +[ qw/id title url/ ], +[ qw/3 ctitle curl/ ] +]); +my $link3 = $schema->resultset('Link')->find(3); +is($link3->id, 3, 'Link 3 id'); +is($link3->url, 'curl', 'Link 3 url'); +is($link3->title, 'ctitle', 'Link 3 title'); + +## not all physical columns +$schema->populate('Link', [ +[ qw/id title/ ], +[ qw/4 dtitle/ ] +]); +my $link4 = $schema->resultset('Link')->find(4); +is($link4->id, 4, 'Link 4 id'); +is($link4->url, undef, 'Link 4 url'); +is($link4->title, 'dtitle', 'Link 4 title'); + + + ok(-f "t/var/DBIxClass.db", 'Database created');